I’m trying to improve the rendering speed of my game engine by taking advantage of opengl ability to repeat a texture if the texture coordinate goes beyond 1.0. The problem than I’m having is that the image that I want to tile is part of a bigger texture. I have manage to get close to archive what I want but I still don’t get the effect right all the times. I will post my code as soon as I get home. The idea is to avoid rendering multiple quads to give the impression that the image is tiled. If I’m not clear just let me know and I will explain my self better. Thanks a lot.
The quick answer is, you can’t, at least not without either cutting out the part you need repeated and place it in it’s own texture, or use some kind of custom texture sampling in the fragment shader.
It terms of performance what would be better? Place render multiple quads using a loop inside glBegin and glEnd, or do what you suggested, make a texture just for that tile image? Thanks for your help.
Quick question. How do I go about rendering a bunch of quads in arbitrary positions, scale, rotation etc, using only one call to glBegin/ glEnd or is this impossible? I’m trying to avoid calling glBegin/ glEnd for every image that I want to render. Thanks a lot.
-R
note: If you want me to start a new thread that’s fine.
Let me put it this way: if you render only few images (rectangles), say a hundred or so, there is no problem with using the immediate mode. If you render much more, then you should use VBOs — either with pre-transformed vertices, or do the transformation in the vertex shader.
Just do it, you only have to drop out of immediate mode when you stop rendering or when you want to change the texture, but “a bunch of quads in arbitrary positions” are no problem.