• Advertisement

Archived

This topic is now archived and is closed to further replies.

glEnable(GL_TEXTURE_2D) and glDisable

This topic is 5038 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Are the functions glEnable(GL_TEXTURE_2D) and glDisable(GL_TEXTURE_2D) fast? I''m using them a lot when I have to switch from textured polygons to colored polygons and text and I''m wondering if it might have a signifiant impact on speed or not?

Share this post


Link to post
Share on other sites
Advertisement
they do a state set so while they wont be mentaly fast unless you are being dumb about thinks (drawing a textured quand, turning it off, drawing a polygon, turning it back on, and repeat) I very much doubt it would be a bottle neck.

If you ARE doing it like that then you''ll want to batch things (infact, do so anyways), so you draw all your textured stuff, then your untextured stuff

Share this post


Link to post
Share on other sites
In my engine, I turn texture on/off quite a few times (once for the particles, then a few times for menus, borders, etc. Thse speed penalty is neglectable.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
In their bare form they should not pose a performance hit because all it''s doing is redirecting some pointers in memory to point to an alternative texture - which is also in memory (slightly oversimplified, but essentially it''s what''s going on). Now loading textures or performing other texture transformations each frame will be a significant hit. If you are seeing any hits, then as _the_phantom_ says, you might need to reorg your code or rethink your strategy. Hope that helps!

Share this post


Link to post
Share on other sites
Ok, thanks

And I don''t think I''m really overusing it anyway,

Share this post


Link to post
Share on other sites
I was told that glBindTexture(GL_TEXTURE_2D, 0); was faster than disabling and re-enabling texturing if you are doing it often.. is the not the case?

Share this post


Link to post
Share on other sites
Hmm, glBindTexture(GL_TEXTURE_2D, 0) is probably faster than disabling the texture, however it''s still doing the texture calculations which (depending on how many polys you''re drawing) would slow it down.

That''s just my guess.

Share this post


Link to post
Share on other sites

  • Advertisement