Implement gl(Enable|Disable)ClientState
This commit is contained in:
parent
f36fc72334
commit
1a80a70614
58
gl-arrays.c
58
gl-arrays.c
|
@ -111,8 +111,6 @@ GLAPI void APIENTRY glVertexPointer(GLint size, GLenum type,
|
|||
|
||||
GL_KOS_VERTEX_STRIDE = (stride) ? stride : _calculate_byte_size(type) * size;
|
||||
GL_KOS_VERTEX_POINTER = (GLubyte *)pointer;
|
||||
|
||||
GL_KOS_VERTEX_PTR_MODE |= GL_KOS_USE_ARRAY;
|
||||
}
|
||||
|
||||
/* Submit a Vertex Normal Pointer */
|
||||
|
@ -128,10 +126,8 @@ GLAPI void APIENTRY glNormalPointer(GLenum type, GLsizei stride, const GLvoid *p
|
|||
return;
|
||||
}
|
||||
|
||||
GL_KOS_NORMAL_STRIDE = (stride) ? stride : _calculate_byte_size(type) * size;
|
||||
GL_KOS_NORMAL_STRIDE = (stride) ? stride : _calculate_byte_size(type) * 3;
|
||||
GL_KOS_NORMAL_POINTER = (GLubyte *)pointer;
|
||||
|
||||
GL_KOS_VERTEX_PTR_MODE |= GL_KOS_USE_NORMAL;
|
||||
}
|
||||
|
||||
/* Submit a Texture Coordinate Pointer */
|
||||
|
@ -154,14 +150,10 @@ GLAPI void APIENTRY glTexCoordPointer(GLint size, GLenum type,
|
|||
if(GL_KOS_CLIENT_ACTIVE_TEXTURE) {
|
||||
GL_KOS_TEXCOORD1_STRIDE = (stride) ? stride : _calculate_byte_size(type) * size;
|
||||
GL_KOS_TEXCOORD1_POINTER = (GLubyte *)pointer;
|
||||
|
||||
GL_KOS_VERTEX_PTR_MODE |= GL_KOS_USE_TEXTURE1;
|
||||
}
|
||||
else {
|
||||
GL_KOS_TEXCOORD0_STRIDE = (stride) ? stride : _calculate_byte_size(type) * size;
|
||||
GL_KOS_TEXCOORD0_POINTER = (GLubyte *)pointer;
|
||||
|
||||
GL_KOS_VERTEX_PTR_MODE |= GL_KOS_USE_TEXTURE0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -195,8 +187,6 @@ GLAPI void APIENTRY glColorPointer(GLint size, GLenum type,
|
|||
}
|
||||
|
||||
GL_KOS_COLOR_STRIDE = (stride) ? stride : _calculate_byte_size(type) * size;
|
||||
|
||||
GL_KOS_VERTEX_PTR_MODE |= GL_KOS_USE_COLOR;
|
||||
}
|
||||
//========================================================================================//
|
||||
//== Vertex Pointer Internal API ==//
|
||||
|
@ -1319,3 +1309,49 @@ void APIENTRY glClientActiveTextureARB(GLenum texture) {
|
|||
|
||||
GL_KOS_CLIENT_ACTIVE_TEXTURE = texture & 0xF;
|
||||
}
|
||||
|
||||
void APIENTRY glEnableClientState(GLenum cap) {
|
||||
switch(cap) {
|
||||
case GL_VERTEX_ARRAY:
|
||||
GL_KOS_VERTEX_PTR_MODE |= GL_KOS_USE_ARRAY;
|
||||
break;
|
||||
case GL_COLOR_ARRAY:
|
||||
GL_KOS_VERTEX_PTR_MODE |= GL_KOS_USE_COLOR;
|
||||
break;
|
||||
case GL_NORMAL_ARRAY:
|
||||
GL_KOS_VERTEX_PTR_MODE |= GL_KOS_USE_NORMAL;
|
||||
break;
|
||||
case GL_TEXTURE_COORD_ARRAY:
|
||||
(GL_KOS_CLIENT_ACTIVE_TEXTURE) ?
|
||||
(GL_KOS_VERTEX_PTR_MODE |= GL_KOS_USE_TEXTURE1):
|
||||
(GL_KOS_VERTEX_PTR_MODE |= GL_KOS_USE_TEXTURE0);
|
||||
break;
|
||||
default:
|
||||
_glKosThrowError(GL_INVALID_ENUM, "glEnableClientState");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void APIENTRY glDisableClientState(GLenum cap) {
|
||||
switch(cap) {
|
||||
case GL_VERTEX_ARRAY:
|
||||
GL_KOS_VERTEX_PTR_MODE &= ~GL_KOS_USE_ARRAY;
|
||||
break;
|
||||
case GL_COLOR_ARRAY:
|
||||
GL_KOS_VERTEX_PTR_MODE &= ~GL_KOS_USE_COLOR;
|
||||
break;
|
||||
case GL_NORMAL_ARRAY:
|
||||
GL_KOS_VERTEX_PTR_MODE &= ~GL_KOS_USE_NORMAL;
|
||||
break;
|
||||
case GL_TEXTURE_COORD_ARRAY:
|
||||
(GL_KOS_CLIENT_ACTIVE_TEXTURE) ?
|
||||
(GL_KOS_VERTEX_PTR_MODE &= ~GL_KOS_USE_TEXTURE1):
|
||||
(GL_KOS_VERTEX_PTR_MODE &= ~GL_KOS_USE_TEXTURE0);
|
||||
break;
|
||||
default:
|
||||
_glKosThrowError(GL_INVALID_ENUM, "glDisableClientState");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
12
include/gl.h
12
include/gl.h
|
@ -235,6 +235,13 @@ __BEGIN_DECLS
|
|||
#define GL_LIGHT14 0x400E
|
||||
#define GL_LIGHT15 0x400F
|
||||
|
||||
/* Client state caps */
|
||||
#define GL_VERTEX_ARRAY 0x8074
|
||||
#define GL_NORMAL_ARRAY 0x8075
|
||||
#define GL_COLOR_ARRAY 0x8076
|
||||
#define GL_INDEX_ARRAY 0x8077
|
||||
#define GL_TEXTURE_COORD_ARRAY 0x8078
|
||||
|
||||
/* LightParameter */
|
||||
#define GL_AMBIENT 0x1200
|
||||
#define GL_DIFFUSE 0x1201
|
||||
|
@ -575,9 +582,8 @@ GLAPI void APIENTRY glColorPointer(GLint size, GLenum type,
|
|||
GLAPI void APIENTRY glDrawArrays(GLenum mode, GLint first, GLsizei count);
|
||||
GLAPI void APIENTRY glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
|
||||
|
||||
/* No need to Enable Array Client State... */
|
||||
#define glEnableClientState(cap) {;}
|
||||
#define glDisableClientState(cap) {;}
|
||||
GLAPI void APIENTRY glEnableClientState(GLenum cap);
|
||||
GLAPI void APIENTRY glDisableClientState(GLenum cap);
|
||||
|
||||
/* Transformation / Matrix Functions */
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user