cant get vertexcolor to work

BlitzMax Forums/MiniB3D Module/cant get vertexcolor to work

Nate the Great(Posted 2011) [#1]
im relatively new to minib3d but I cannot for the life of me figure out how to use vertexcolor... here is a simple example that should display a triangle shaded different colors but it doesnt work. Did I miss something obvious or does minib3d not support vertex colors or could it be my graphics card? (its only like 3 years old)

I was also curious if there is a way to change the vertex's alpha value?

Import "mb\minib3d.bmx"

Graphics3D 800,600,0,2

mesh=CreateMesh()
surf=CreateSurface( mesh )

addvertex surf,1,0,0
addvertex surf,-1,1,0
addvertex surf,-1,-1,0


addtriangle surf,0,2,1

vertexcolor surf,0,255,0,0
vertexcolor surf,1,0,255,0
vertexcolor surf,2,0,0,255

camera=CreateCamera()
PositionEntity camera,0,0,-5

light=CreateLight()
TurnEntity light,45,45,0

While Not KeyHit(KEY_ESCAPE)
	
	UpdateNormals mesh	
	UpdateWorld
	RenderWorld
		
	Flip
Wend
End


Last edited 2011


AdamRedwoods(Posted 2011) [#2]
EntityFX mesh,2

This will set the mesh to use vertex colors instead of textures. When you have no texture, OpenGL displays the texture as white.


Nate the Great(Posted 2011) [#3]
oh ok I see now... so I want to do a simple vertex based lighting system for my game, but I still want textures on surfaces that are being lit (obviously)
so what im asking is how do i use both vertexcolor and a brush texture at the same time?

edit: nevermind I simply misspelled the name of the image and assumed it was the setting that was causing it not to show up.. Thanks a bunch!

Last edited 2011