[osg-users] Texturing with GLBeginEndAdapter

Alberto Luaces aluaces at udc.es
Thu Dec 29 00:31:24 PST 2016

Aaron Andersen writes:

> I've created a subclass to the Drawable class called "MyDrawable". In
> the drawImplementation function I'm have a couple
> gl.Begin(GL_QUADS)/gl.End() calls to draw 3 simple rectangles. I'm
> unsure of how to apply 3 separate textures to these 3 rectangles. From
> reading the ShapeDrawable class it looks like the state of the
> Drawable applies the texture to everything you draw.

Hi Aaron, if I am not mistaken, it is unlikely that the original code
did that (without any multi-texturing tricks, I think).

Probably it had a glBegin/glEnd block, a texture binding change, and
then the next glBegin/glEnd block.

That translates in OSG as —as you figured out— several Drawables with
their own StateSet each one (at least one StateSet per different
texture).  You can try to group into the same Drawable all the
primitives sharing the same texture.


More information about the osg-users mailing list