[Bf-committers] glGetIntegerv(GL_TEXTURE_2D. &id) is incorrect.

Mitchell Stokes mogurijin at gmail.com
Tue Jul 23 01:02:55 CEST 2013


I'm all for getting rid of unneeded glGet calls. Really, we should strive
to only use glGet calls in initialization type functions since they slow
down normal program execution. If we really need to save a value, we should
use the (deprecated) glPush/PopAttrib, or use EXT_direct_state_access[0] to
avoid the issue entirely.

--Mitchell

[0] https://www.opengl.org/registry/specs/EXT/direct_state_access.txt


On Mon, Jul 22, 2013 at 3:44 PM, Jason Wilkins <jason.a.wilkins at gmail.com>wrote:

> GL_TEXTURE_2D is the enable bit, not the bound texture.
>
> So, the code...
>
> glGetIntegerv(GL_TEXTURE_2D. &prev_tex_id)
>
> ... also sometimes written as ...
>
> prev_tex_id = glaGetOneInteger(GL_TEXTURE_2D)
>
> ... is incorrect, I think what is meant is the binding state...
>
> glGetIntegerv(GL_TEXTURE_BINDING_2D, &prev_tex_id)
>
> ... or ...
>
> prev_tex_id = glaGetOneInteger(GL_TEXTURE_BINDING_2D)
>
> The fact that Blender still works tells me that this code (and the later
> code rebinding the previous texture) is probably unneeded and can be
> removed.  It must be that all functions that draw with a texture map do not
> call other functions that change the texture before they need the previous
> texture again.
>
> This is especially apparent since any call to a function that has this bug
> will result in the bound texture being either 0 or 1 (The value of GL_FALSE
> and GL_TRUE).
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers
>


More information about the Bf-committers mailing list