PDA

View Full Version : Textures



Diggsey
11-03-2010, 10:16 AM
I'm learning OpenGL at the moment (I've only really used D3D in the past) and am currently writing a class to manage states, but I have a few questions I need answering:

1) Certain states and commands (such as glBindTexture) affect the active texture, set by glActiveTexture. Is there a definitive list of these states and commands?

2) I know that you set properties of a texture first by binding it using glBindTexture, and then calling the relevant commmands. Are any of these properties attached to the texture itself, or do they stay within the opengl context?

Thanks for the help,
Diggory

aqnuep
11-03-2010, 12:36 PM
1) Certain states and commands (such as glBindTexture) affect the active texture, set by glActiveTexture. Is there a definitive list of these states and commands?

Yes, this is one of the key problems of OpenGL compared to other APIs, namely the bind-to-modify mechanism. This problem is addressed by the GL_EXT_direct_state_access extension that provides bindless modification commands, including for the command you've mentioned.


2) I know that you set properties of a texture first by binding it using glBindTexture, and then calling the relevant commmands. Are any of these properties attached to the texture itself, or do they stay within the opengl context?

No, these properties do not stay in the context but rather are associated with the texture itself. The OpenGL specification has details about all states (at least almost all of them) whether they are per-context or they are associated to a particular object currently bound.