which is the less system costly?
my question originates from me wondering why my program is loosing framerate durring what i would think to be a fairly light graphics scene.
so i ask, would one very large texture be easier on the system then one smaller texture repeated several times on seperate polygons?
the context is something that looks kinda like nehe''s height map tutorial, i have 400 textured polygons, using the same 256x256 texture.
a side note, is there any way for me to tell that i''m using my video card and that this isn''t being run entirly by my processor? or does opengl automaticlly utilize the video card?
thankyou
Open GL should automatically use your graphics card if it is OpenGL compliant ( make sure you have the current drivers ).
The smaller the texture the less memory used. Texture size shouldn''t really that much unless you are using many textures. A single 256x256 texture should cause no problem at all.
How are you drawing the polygons themselves? Are you using glBegin() glEnd() or Vertex Arrays? Also are you using triangle fans/strips, quads, or plain triangles?
The smaller the texture the less memory used. Texture size shouldn''t really that much unless you are using many textures. A single 256x256 texture should cause no problem at all.
How are you drawing the polygons themselves? Are you using glBegin() glEnd() or Vertex Arrays? Also are you using triangle fans/strips, quads, or plain triangles?
quote:
Original post by AdamZL
... i have 400 textured polygons, using the same 256x256 texture ...
that sounds a bit suspicious...
are you calling glBindTexture for every polygon you draw? (glBindTexture flushes the entire rendering pipeline clean so it is NOT a cheap call to make, and very foolish if it''s binding the same texture)
| - Project-X - my mega project.. getting warmer

As RipTorn said, make sure you are binding the texture only once. Avoid unnecessary glBindTexture calls by grouping things together, since lots of state changes can slow down your code.
ie:
instead of
glBindTexture(GL_TEXTURE_2D, texture[0]);
DrawObject1();
glBindTexture(GL_TEXTURE_2D, texture[1]);
DrawObject2();
glBindTexture(GL_TEXTURE_2D, texture[0]);
DrawObject3();
use
glBindTexture(GL_TEXTURE_2D, texture[0]);
DrawObject1();
DrawObject3();
glBindTexture(GL_TEXTURE_2D, texture[1]);
DrawObject2();
Of course you won''t notice a speed difference if it''s just something small like that, but you will if you are calling glBindTexture more than, say, 20 times per frame if it''s not needed.
ie:
instead of
glBindTexture(GL_TEXTURE_2D, texture[0]);
DrawObject1();
glBindTexture(GL_TEXTURE_2D, texture[1]);
DrawObject2();
glBindTexture(GL_TEXTURE_2D, texture[0]);
DrawObject3();
use
glBindTexture(GL_TEXTURE_2D, texture[0]);
DrawObject1();
DrawObject3();
glBindTexture(GL_TEXTURE_2D, texture[1]);
DrawObject2();
Of course you won''t notice a speed difference if it''s just something small like that, but you will if you are calling glBindTexture more than, say, 20 times per frame if it''s not needed.
lemme guess. your framerate is either 60/70/85 or exactly what the refresh rate of your monitor is, yes? your problem could also be what other people have said but you are suffering from your program being locked with vsync. i.e. your graphics card hand on the swapBuffer command until the monitor is ready to receive the data. just turn off vsync and your framerate will jump a lot.
you can turn it off programatically, and when i find the code i''ll add it here. you can also just switch it off from the display control panel usually.
if turning off vsync fails check that you have the latest driver for your video card, and that your video card is actually a 3D card....
-me
you can turn it off programatically, and when i find the code i''ll add it here. you can also just switch it off from the display control panel usually.
if turning off vsync fails check that you have the latest driver for your video card, and that your video card is actually a 3D card....
-me
thanks guys it was the glBindTexture problem. also thankyou on the vsync thing i was wondering about that.
thankyou
thankyou
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement