This might sound max stupid but i have a small query.
When i render something using shader, i don't use glEnable(GL_TEXTURE_2D) .
But when i render my GUI it looks it won't render without enabling TEXTURE_2D (fixed pplne), so the question is - should i go and render the gui with shader to get rid of
glEnable(GL_TEXTURE_2D) call per frame basis? Or there is something else i forgot about...
Thanks!
glEnable(GL_TEXTURE_2D) - really?
Hello donmof,
I suggest you try multitexturing on your shader and see what happens, that will give you a good knowledge on what is going on in OGL state machine.
As for the answer to your question, glEnable( GL_TEXTURE_2D), enables sampler 0 within the state machine. So for instance whenever you bind something it will only go to sampler 0 within the pipeline. On a fixed pipeline behavior this means more or less: texturing to first coords with sampler 0. On a programable pipeline you do assume texture sampler is 0 only (in your case), and therefore is straightforward. If you try what I suggested you will see same behavior on both shader and fixed pipeline for multitexturing, and see what happens really (as you will need to specify what sampler are you binding what texture).
Cheers.
I suggest you try multitexturing on your shader and see what happens, that will give you a good knowledge on what is going on in OGL state machine.
As for the answer to your question, glEnable( GL_TEXTURE_2D), enables sampler 0 within the state machine. So for instance whenever you bind something it will only go to sampler 0 within the pipeline. On a fixed pipeline behavior this means more or less: texturing to first coords with sampler 0. On a programable pipeline you do assume texture sampler is 0 only (in your case), and therefore is straightforward. If you try what I suggested you will see same behavior on both shader and fixed pipeline for multitexturing, and see what happens really (as you will need to specify what sampler are you binding what texture).
Cheers.
Assuming you are single texturing your gui, you can just enable texturing for the active texture unit 0. Just keep it enabled for your whole program. You only need to enable/disable if multitexturing in the fixed function because the highest unit takes precedence.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement