PDA

View Full Version : Why no per-vertex material specification in vertex array?



MelvinEng
10-08-2001, 04:25 PM
I keep wondering....why is there no glMaterialPointer() call or something to that effect for vertex arrays? You can call glMaterial() between a glBegin()/glEnd() block to change the current material in the middle of the vertex list....so why not the same when you specify a vertex list with glDrawElements() or glDrawArrays()? (and the darn thing is that there IS a glColorPointer() call! But I'm only interested in colors as a result of shading...)

PS: for that matter...why can't calls that change the current texture(like glBindTexture() or glTexImage2D() etc) be nested inside a glBegin()/glEnd() block? Or to take it further...a glBindTexturePointer() call for vertex arrays?


Very Perplexed! http://www.opengl.org/discussion_boards/ubb/frown.gif

Rob The Bloke
10-09-2001, 02:20 AM
When drawing geometry, batch polys up into material types and texture types. switching textures is very slow so should be done as few times as possible.

As for materials, you can make use of an array of colours, and enable glColorMaterial. You cant control all attributes at once (ie, only control one of GL_AMBIENT,GL_DIFFUSE,GL_SPECULAR or GL_AMBIENT_AND_DIFFUSE).

This is as flexible as it gets......