开发者

textures and vertex arrays with OpenGL?

Basically what I'd like to do is make textured NGONS. I also want to use a tesselator (GLU) to make concave and multicontour objects.

I was wondering how the texture comes into play though. I think that the tesselator will return verticies so I will add these to my array, that's fine. But my开发者_如何学编程 vertex array will contain more than one polygon object so then how can I tell it when to bind the texture like in immediate mode? Right now I feel stuck with one call to bind.

How can this be done? Thanks


If you're going to use glDrawArrays or glDrawElements, you'll have to draw your vertices in pieces, one piece per texture. The same texture is used for the entire call. (These calls are like a potentially more efficient version of submitting the same data by hand within glBegin and glEnd, and you can't change texture inside a glBegin...glEnd block, either.)

You could alternatively stick with glBegin and glEnd, and use glArrayElement to submit vertices whose attributes are taken out of the vertex arrays.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜