Implement glAlphaFunc and glEnable(GL_ALPHA_TEST)
This commit is contained in:
parent
25bd3aedc8
commit
04dab8da9a
|
@ -55,6 +55,8 @@ static void _glInitPVR() {
|
|||
PolyList* _glActivePolyList() {
|
||||
if(_glIsBlendingEnabled()) {
|
||||
return &TR_LIST;
|
||||
} else if(_glIsAlphaTestEnabled()) {
|
||||
return &PT_LIST;
|
||||
} else {
|
||||
return &OP_LIST;
|
||||
}
|
||||
|
|
|
@ -152,6 +152,8 @@ GLboolean _glIsSharedTexturePaletteEnabled();
|
|||
void _glApplyColorTable(TexturePalette *palette);
|
||||
|
||||
GLboolean _glIsBlendingEnabled();
|
||||
GLboolean _glIsAlphaTestEnabled();
|
||||
|
||||
GLboolean _glIsMipmapComplete(const TextureObject* obj);
|
||||
GLubyte* _glGetMipmapLocation(TextureObject* obj, GLuint level);
|
||||
GLuint _glGetMipmapLevelCount(TextureObject* obj);
|
||||
|
|
29
GL/state.c
29
GL/state.c
|
@ -30,6 +30,9 @@ static GLboolean COLOR_MATERIAL_ENABLED = GL_FALSE;
|
|||
/* Is the shared texture palette enabled? */
|
||||
static GLboolean SHARED_PALETTE_ENABLED = GL_FALSE;
|
||||
|
||||
static GLboolean ALPHA_TEST_ENABLED = GL_FALSE;
|
||||
|
||||
|
||||
GLboolean _glIsSharedTexturePaletteEnabled() {
|
||||
return SHARED_PALETTE_ENABLED;
|
||||
}
|
||||
|
@ -84,6 +87,10 @@ GLboolean _glIsBlendingEnabled() {
|
|||
return BLEND_ENABLED;
|
||||
}
|
||||
|
||||
GLboolean _glIsAlphaTestEnabled() {
|
||||
return ALPHA_TEST_ENABLED;
|
||||
}
|
||||
|
||||
static int _calcPVRBlendFactor(GLenum factor) {
|
||||
switch(factor) {
|
||||
case GL_ZERO:
|
||||
|
@ -311,6 +318,9 @@ GLAPI void APIENTRY glEnable(GLenum cap) {
|
|||
SHARED_PALETTE_ENABLED = GL_TRUE;
|
||||
}
|
||||
break;
|
||||
case GL_ALPHA_TEST: {
|
||||
ALPHA_TEST_ENABLED = GL_TRUE;
|
||||
} break;
|
||||
case GL_LIGHT0:
|
||||
case GL_LIGHT1:
|
||||
case GL_LIGHT2:
|
||||
|
@ -362,6 +372,9 @@ GLAPI void APIENTRY glDisable(GLenum cap) {
|
|||
SHARED_PALETTE_ENABLED = GL_FALSE;
|
||||
}
|
||||
break;
|
||||
case GL_ALPHA_TEST: {
|
||||
ALPHA_TEST_ENABLED = GL_FALSE;
|
||||
} break;
|
||||
case GL_LIGHT0:
|
||||
case GL_LIGHT1:
|
||||
case GL_LIGHT2:
|
||||
|
@ -457,8 +470,20 @@ GLAPI void APIENTRY glBlendFunc(GLenum sfactor, GLenum dfactor) {
|
|||
_updatePVRBlend(&GL_CONTEXT);
|
||||
}
|
||||
|
||||
void glAlphaFunc(GLenum func, GLclampf ref) {
|
||||
;
|
||||
#define PT_ALPHA_REF 0x011c
|
||||
|
||||
GLAPI void APIENTRY glAlphaFunc(GLenum func, GLclampf ref) {
|
||||
GLenum validFuncs[] = {
|
||||
GL_GREATER,
|
||||
0
|
||||
};
|
||||
|
||||
if(_glCheckValidEnum(func, validFuncs, __func__) != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
GLubyte val = (GLubyte)(ref * 255.0f);
|
||||
PVR_SET(PT_ALPHA_REF, val);
|
||||
}
|
||||
|
||||
void glLineWidth(GLfloat width) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user