Properly pop active client texture in immediate mode

This commit is contained in:
Luke Benstead 2018-08-21 15:50:59 +01:00
parent 25de48b3f6
commit edae8a9166
4 changed files with 13 additions and 0 deletions

View File

@ -961,6 +961,10 @@ void APIENTRY glDisableClientState(GLenum cap) {
}
}
GLuint _glGetActiveClientTexture() {
return ACTIVE_CLIENT_TEXTURE;
}
void APIENTRY glClientActiveTextureARB(GLenum texture) {
TRACE();

View File

@ -164,6 +164,9 @@ void APIENTRY glEnd() {
glColorPointer(4, GL_FLOAT, 0, COLOURS.data);
glNormalPointer(GL_FLOAT, 0, NORMALS.data);
GLint activeTexture;
glGetIntegerv(GL_CLIENT_ACTIVE_TEXTURE, &activeTexture);
glClientActiveTextureARB(GL_TEXTURE0);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer(2, GL_FLOAT, 0, UV_COORDS.data);
@ -174,6 +177,8 @@ void APIENTRY glEnd() {
glDrawArrays(ACTIVE_POLYGON_MODE, 0, VERTICES.size / 3);
glClientActiveTextureARB((GLuint) activeTexture);
aligned_vector_clear(&VERTICES);
aligned_vector_clear(&COLOURS);
aligned_vector_clear(&UV_COORDS);

View File

@ -103,6 +103,7 @@ TextureObject* getTexture0();
TextureObject* getTexture1();
TextureObject* getBoundTexture();
GLubyte _glGetActiveTexture();
GLuint _glGetActiveClientTexture();
GLboolean isBlendingEnabled();
GLboolean _glIsMipmapComplete(const TextureObject* obj);

View File

@ -519,6 +519,9 @@ void APIENTRY glGetIntegerv(GLenum pname, GLint *params) {
case GL_ACTIVE_TEXTURE:
*params = GL_TEXTURE0 + _glGetActiveTexture();
break;
case GL_CLIENT_ACTIVE_TEXTURE:
*params = GL_TEXTURE0 + _glGetActiveClientTexture();
break;
case GL_COMPRESSED_TEXTURE_FORMATS_ARB: {
GLuint i = 0;
for(; i < NUM_COMPRESSED_FORMATS; ++i) {