I am using OGLES-1.1_WINDOWS_PCEMULATION_2.05.25.0804.
I am developing on Visual Studio 2003 and using “OpenGLES common” version.
I am using the following code lines to retrive the current texture unit in my own project:
GLint activeTxtUnit;
glGetIntegerv(GL_ACTIVE_TEXTURE, &activeTxtUnit);
it seems that this function call corrupts the stack and it does not retrieve the correct value.
I tryed the same code into the following training project
PowerVR SDKOGLES-1.1_WINDOWS_PCEMULATION_2.05.25.0804TrainingCourse10_MultitextureOGLES (into the function OGLESMultitexture::EnableStates).
The result is the same.
Does anyone had the same problem or can help me?
Is it a PowerVR SDK bug?
I'm sorry for a late reposne. Yes, this is a bug in pcemulation. Fix for it will be included in our next release. Thanks for reporting it to us.
I am using 2.08.28.0634, and the two bugs named in the original posting (corrupt stack and incorrect value) appear to still be there. I get a “Run-Time Check Failure #2 - Stack around the variable ‘prevActiveTexUnit’ was corrupted.” when I exit a function that contains:
GLint prevActiveTexUnit;
glGetIntegerv(GL_ACTIVE_TEXTURE, &prevActiveTexUnit);
glActiveTexture(GL_TEXTURE0 + 1);
// etc.
glActiveTexture(GL_TEXTURE0 + prevActiveTexUnit);
This code was fine before adding the code for putting back the prevActiveTexUnit. Also, the value for prevActiveTexUnit seems to be 0-based instead of GL_TEXTURE0-based. From my reading of the standard, it seems that it should be GL_TEXTURE0-based.
Thanks for your report. We will be looking at that shortly.
Regards,
GL_ACTIVE_TEXTURE stores the enum value, not the number of the unit starting from 0. As the specification states, the initial value is GL_TEXTURE0.