Properly restore state after glEnd
This commit is contained in:
parent
9b0322ce8a
commit
21f8f9d855
27
GL/draw.c
27
GL/draw.c
|
@ -8,13 +8,6 @@
|
||||||
#include "private.h"
|
#include "private.h"
|
||||||
#include "profiler.h"
|
#include "profiler.h"
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
const void* ptr;
|
|
||||||
GLenum type;
|
|
||||||
GLsizei stride;
|
|
||||||
GLint size;
|
|
||||||
} AttribPointer;
|
|
||||||
|
|
||||||
|
|
||||||
static AttribPointer VERTEX_POINTER;
|
static AttribPointer VERTEX_POINTER;
|
||||||
static AttribPointer UV_POINTER;
|
static AttribPointer UV_POINTER;
|
||||||
|
@ -76,6 +69,26 @@ GLuint _glGetEnabledAttributes() {
|
||||||
return ENABLED_VERTEX_ATTRIBUTES;
|
return ENABLED_VERTEX_ATTRIBUTES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AttribPointer* _glGetVertexAttribPointer() {
|
||||||
|
return &VERTEX_POINTER;
|
||||||
|
}
|
||||||
|
|
||||||
|
AttribPointer* _glGetDiffuseAttribPointer() {
|
||||||
|
return &DIFFUSE_POINTER;
|
||||||
|
}
|
||||||
|
|
||||||
|
AttribPointer* _glGetNormalAttribPointer() {
|
||||||
|
return &NORMAL_POINTER;
|
||||||
|
}
|
||||||
|
|
||||||
|
AttribPointer* _glGetUVAttribPointer() {
|
||||||
|
return &UV_POINTER;
|
||||||
|
}
|
||||||
|
|
||||||
|
AttribPointer* _glGetSTAttribPointer() {
|
||||||
|
return &ST_POINTER;
|
||||||
|
}
|
||||||
|
|
||||||
static inline void _parseVec3FromShort3(GLfloat* out, const GLubyte* in) {
|
static inline void _parseVec3FromShort3(GLfloat* out, const GLubyte* in) {
|
||||||
GLshort* ptr = (GLshort*) in;
|
GLshort* ptr = (GLshort*) in;
|
||||||
|
|
||||||
|
|
|
@ -161,7 +161,11 @@ void APIENTRY glEnd() {
|
||||||
glGetBooleanv(GL_COLOR_ARRAY, &colorArrayEnabled);
|
glGetBooleanv(GL_COLOR_ARRAY, &colorArrayEnabled);
|
||||||
glGetBooleanv(GL_NORMAL_ARRAY, &normalArrayEnabled);
|
glGetBooleanv(GL_NORMAL_ARRAY, &normalArrayEnabled);
|
||||||
|
|
||||||
/* FIXME: Push pointer state */
|
AttribPointer vptr = *_glGetVertexAttribPointer();
|
||||||
|
AttribPointer dptr = *_glGetDiffuseAttribPointer();
|
||||||
|
AttribPointer nptr = *_glGetNormalAttribPointer();
|
||||||
|
AttribPointer uvptr = *_glGetUVAttribPointer();
|
||||||
|
AttribPointer stptr = *_glGetSTAttribPointer();
|
||||||
|
|
||||||
glEnableClientState(GL_VERTEX_ARRAY);
|
glEnableClientState(GL_VERTEX_ARRAY);
|
||||||
glEnableClientState(GL_COLOR_ARRAY);
|
glEnableClientState(GL_COLOR_ARRAY);
|
||||||
|
@ -192,6 +196,12 @@ void APIENTRY glEnd() {
|
||||||
aligned_vector_clear(&ST_COORDS);
|
aligned_vector_clear(&ST_COORDS);
|
||||||
aligned_vector_clear(&NORMALS);
|
aligned_vector_clear(&NORMALS);
|
||||||
|
|
||||||
|
*_glGetVertexAttribPointer() = vptr;
|
||||||
|
*_glGetDiffuseAttribPointer() = dptr;
|
||||||
|
*_glGetNormalAttribPointer() = nptr;
|
||||||
|
*_glGetUVAttribPointer() = uvptr;
|
||||||
|
*_glGetSTAttribPointer() = stptr;
|
||||||
|
|
||||||
if(!vertexArrayEnabled) {
|
if(!vertexArrayEnabled) {
|
||||||
glDisableClientState(GL_VERTEX_ARRAY);
|
glDisableClientState(GL_VERTEX_ARRAY);
|
||||||
}
|
}
|
||||||
|
@ -216,8 +226,6 @@ void APIENTRY glEnd() {
|
||||||
|
|
||||||
glClientActiveTextureARB((GLuint) activeTexture);
|
glClientActiveTextureARB((GLuint) activeTexture);
|
||||||
|
|
||||||
|
|
||||||
/* FIXME: Pop pointers */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void APIENTRY glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2) {
|
void APIENTRY glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2) {
|
||||||
|
|
12
GL/private.h
12
GL/private.h
|
@ -105,7 +105,19 @@ GLubyte _glKosInitTextures();
|
||||||
|
|
||||||
void _glUpdatePVRTextureContext(pvr_poly_cxt_t* context, GLshort textureUnit);
|
void _glUpdatePVRTextureContext(pvr_poly_cxt_t* context, GLshort textureUnit);
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
const void* ptr;
|
||||||
|
GLenum type;
|
||||||
|
GLsizei stride;
|
||||||
|
GLint size;
|
||||||
|
} AttribPointer;
|
||||||
|
|
||||||
GLuint _glGetEnabledAttributes();
|
GLuint _glGetEnabledAttributes();
|
||||||
|
AttribPointer* _glGetVertexAttribPointer();
|
||||||
|
AttribPointer* _glGetDiffuseAttribPointer();
|
||||||
|
AttribPointer* _glGetNormalAttribPointer();
|
||||||
|
AttribPointer* _glGetUVAttribPointer();
|
||||||
|
AttribPointer* _glGetSTAttribPointer();
|
||||||
|
|
||||||
TextureObject* getTexture0();
|
TextureObject* getTexture0();
|
||||||
TextureObject* getTexture1();
|
TextureObject* getTexture1();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user