mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-12-25 02:00:54 +00:00
Changed: Simplify OpenGL ES driver by using some aliases
This commit is contained in:
parent
7dba15d533
commit
0dd9100e85
6 changed files with 46 additions and 113 deletions
|
@ -1337,11 +1337,7 @@ void CDriverGL::copyFrameBufferToTexture(ITexture *tex,
|
||||||
{
|
{
|
||||||
if(_Extensions.ARBTextureCubeMap)
|
if(_Extensions.ARBTextureCubeMap)
|
||||||
{
|
{
|
||||||
#ifdef USE_OPENGLES
|
|
||||||
glBindTexture(GL_TEXTURE_CUBE_MAP_OES, gltext->ID);
|
|
||||||
#else
|
|
||||||
glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, gltext->ID);
|
glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, gltext->ID);
|
||||||
#endif
|
|
||||||
glCopyTexSubImage2D(NLCubeFaceToGLCubeFace[cubeFace], level, offsetx, offsety, x, y, width, height);
|
glCopyTexSubImage2D(NLCubeFaceToGLCubeFace[cubeFace], level, offsetx, offsety, x, y, width, height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2626,11 +2622,10 @@ void CDriverGL::checkTextureOn() const
|
||||||
GLboolean flagCM;
|
GLboolean flagCM;
|
||||||
GLboolean flagTR;
|
GLboolean flagTR;
|
||||||
glGetBooleanv(GL_TEXTURE_2D, &flag2D);
|
glGetBooleanv(GL_TEXTURE_2D, &flag2D);
|
||||||
|
glGetBooleanv(GL_TEXTURE_CUBE_MAP_ARB, &flagCM);
|
||||||
#ifdef USE_OPENGLES
|
#ifdef USE_OPENGLES
|
||||||
glGetBooleanv(GL_TEXTURE_CUBE_MAP_OES, &flagCM);
|
|
||||||
flagTR = true; // always true in OpenGL ES
|
flagTR = true; // always true in OpenGL ES
|
||||||
#else
|
#else
|
||||||
glGetBooleanv(GL_TEXTURE_CUBE_MAP_ARB, &flagCM);
|
|
||||||
glGetBooleanv(GL_TEXTURE_RECTANGLE_NV, &flagTR);
|
glGetBooleanv(GL_TEXTURE_RECTANGLE_NV, &flagTR);
|
||||||
#endif
|
#endif
|
||||||
switch(dgs.getTextureMode())
|
switch(dgs.getTextureMode())
|
||||||
|
|
|
@ -628,7 +628,7 @@ static bool setupARBTextureNonPowerOfTwo(const char *glext)
|
||||||
{
|
{
|
||||||
H_AUTO_OGL(setupARBTextureCompression);
|
H_AUTO_OGL(setupARBTextureCompression);
|
||||||
|
|
||||||
#ifndef USE_OPENGL_ES
|
#ifndef USE_OPENGLES
|
||||||
CHECK_EXT("GL_ARB_texture_non_power_of_two");
|
CHECK_EXT("GL_ARB_texture_non_power_of_two");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -805,20 +805,20 @@ static bool setupARBTextureCubeMap(const char *glext)
|
||||||
|
|
||||||
#ifdef USE_OPENGLES
|
#ifdef USE_OPENGLES
|
||||||
CHECK_EXT("OES_texture_cube_map");
|
CHECK_EXT("OES_texture_cube_map");
|
||||||
|
|
||||||
|
CHECK_ADDRESS(NEL_PFNGLTEXGENFOESPROC, glTexGenfOES);
|
||||||
|
CHECK_ADDRESS(NEL_PFNGLTEXGENFVOESPROC, glTexGenfvOES);
|
||||||
|
CHECK_ADDRESS(NEL_PFNGLTEXGENIOESPROC, glTexGeniOES);
|
||||||
|
CHECK_ADDRESS(NEL_PFNGLTEXGENIVOESPROC, glTexGenivOES);
|
||||||
|
CHECK_ADDRESS(NEL_PFNGLTEXGENXOESPROC, glTexGenxOES);
|
||||||
|
CHECK_ADDRESS(NEL_PFNGLTEXGENXVOESPROC, glTexGenxvOES);
|
||||||
|
CHECK_ADDRESS(NEL_PFNGLGETTEXGENFVOESPROC, glGetTexGenfvOES);
|
||||||
|
CHECK_ADDRESS(NEL_PFNGLGETTEXGENIVOESPROC, glGetTexGenivOES);
|
||||||
|
CHECK_ADDRESS(NEL_PFNGLGETTEXGENXVOESPROC, glGetTexGenxvOES);
|
||||||
#else
|
#else
|
||||||
CHECK_EXT("GL_ARB_texture_cube_map");
|
CHECK_EXT("GL_ARB_texture_cube_map");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// CHECK_ADDRESS(NEL_PFNGLTEXGENFOESPROC, glTexGenfOES);
|
|
||||||
// CHECK_ADDRESS(NEL_PFNGLTEXGENFVOESPROC, glTexGenfvOES);
|
|
||||||
// CHECK_ADDRESS(NEL_PFNGLTEXGENIOESPROC, glTexGeniOES);
|
|
||||||
// CHECK_ADDRESS(NEL_PFNGLTEXGENIVOESPROC, glTexGenivOES);
|
|
||||||
// CHECK_ADDRESS(NEL_PFNGLTEXGENXOESPROC, glTexGenxOES);
|
|
||||||
// CHECK_ADDRESS(NEL_PFNGLTEXGENXVOESPROC, glTexGenxvOES);
|
|
||||||
// CHECK_ADDRESS(NEL_PFNGLGETTEXGENFVOESPROC, glGetTexGenfvOES);
|
|
||||||
// CHECK_ADDRESS(NEL_PFNGLGETTEXGENIVOESPROC, glGetTexGenivOES);
|
|
||||||
// CHECK_ADDRESS(NEL_PFNGLGETTEXGENXVOESPROC, glGetTexGenxvOES);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1499,11 +1499,7 @@ void registerGlExtensions(CGlExtensions &ext)
|
||||||
ext.ARBMultiTexture= setupARBMultiTexture(glext);
|
ext.ARBMultiTexture= setupARBMultiTexture(glext);
|
||||||
if(ext.ARBMultiTexture)
|
if(ext.ARBMultiTexture)
|
||||||
{
|
{
|
||||||
#ifdef USE_OPENGLES
|
|
||||||
glGetIntegerv(GL_MAX_TEXTURE_UNITS, &ntext);
|
|
||||||
#else
|
|
||||||
glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &ntext);
|
glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &ntext);
|
||||||
#endif
|
|
||||||
// We could have more than IDRV_MAT_MAXTEXTURES but the interface only
|
// We could have more than IDRV_MAT_MAXTEXTURES but the interface only
|
||||||
// support IDRV_MAT_MAXTEXTURES texture stages so take min
|
// support IDRV_MAT_MAXTEXTURES texture stages so take min
|
||||||
ext.NbTextureStages= (ntext<((GLint)IDRV_MAT_MAXTEXTURES)?ntext:IDRV_MAT_MAXTEXTURES);
|
ext.NbTextureStages= (ntext<((GLint)IDRV_MAT_MAXTEXTURES)?ntext:IDRV_MAT_MAXTEXTURES);
|
||||||
|
|
|
@ -63,6 +63,20 @@ typedef void (APIENTRY * NEL_PFNGLGETTEXGENFVOESPROC) (GLenum coord, GLenum pnam
|
||||||
typedef void (APIENTRY * NEL_PFNGLGETTEXGENIVOESPROC) (GLenum coord, GLenum pname, GLint *params);
|
typedef void (APIENTRY * NEL_PFNGLGETTEXGENIVOESPROC) (GLenum coord, GLenum pname, GLint *params);
|
||||||
typedef void (APIENTRY * NEL_PFNGLGETTEXGENXVOESPROC) (GLenum coord, GLenum pname, GLfixed *params);
|
typedef void (APIENTRY * NEL_PFNGLGETTEXGENXVOESPROC) (GLenum coord, GLenum pname, GLfixed *params);
|
||||||
|
|
||||||
|
#define GL_MULTISAMPLE_ARB GL_MULTISAMPLE
|
||||||
|
#define GL_TEXTURE_CUBE_MAP_ARB GL_TEXTURE_CUBE_MAP_OES
|
||||||
|
#define GL_NONE 0
|
||||||
|
#define GL_MAX_TEXTURE_UNITS_ARB GL_MAX_TEXTURE_UNITS
|
||||||
|
#define GL_REFLECTION_MAP_ARB GL_REFLECTION_MAP_OES
|
||||||
|
#define GL_RGB_SCALE_EXT GL_RGB_SCALE
|
||||||
|
#define GL_REFLECTION_MAP_ARB GL_REFLECTION_MAP_OES
|
||||||
|
#define GL_PREVIOUS_EXT GL_PREVIOUS
|
||||||
|
#define GL_PRIMARY_COLOR_EXT GL_PRIMARY_COLOR
|
||||||
|
#define GL_CONSTANT_EXT GL_CONSTANT
|
||||||
|
#define GL_ADD_SIGNED_EXT GL_ADD_SIGNED
|
||||||
|
#define GL_INTERPOLATE_EXT GL_INTERPOLATE
|
||||||
|
#define GL_BUMP_ENVMAP_ATI GL_INTERPOLATE
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
|
|
|
@ -87,10 +87,9 @@ static inline void convTexAddr(ITexture *tex, CMaterial::TTexAddressingMode mode
|
||||||
nlassert(mode < CMaterial::TexAddrCount);
|
nlassert(mode < CMaterial::TexAddrCount);
|
||||||
static const GLenum glTex2dAddrModesNV[] =
|
static const GLenum glTex2dAddrModesNV[] =
|
||||||
{
|
{
|
||||||
#ifdef USE_OPENGLES
|
GL_NONE, GL_TEXTURE_2D,
|
||||||
0, GL_TEXTURE_2D
|
#ifndef USE_OPENGLES
|
||||||
#else
|
GL_PASS_THROUGH_NV, GL_CULL_FRAGMENT_NV,
|
||||||
GL_NONE, GL_TEXTURE_2D, GL_PASS_THROUGH_NV, GL_CULL_FRAGMENT_NV,
|
|
||||||
GL_OFFSET_TEXTURE_2D_NV, GL_OFFSET_TEXTURE_2D_SCALE_NV,
|
GL_OFFSET_TEXTURE_2D_NV, GL_OFFSET_TEXTURE_2D_SCALE_NV,
|
||||||
GL_DEPENDENT_AR_TEXTURE_2D_NV, GL_DEPENDENT_GB_TEXTURE_2D_NV,
|
GL_DEPENDENT_AR_TEXTURE_2D_NV, GL_DEPENDENT_GB_TEXTURE_2D_NV,
|
||||||
GL_DOT_PRODUCT_NV, GL_DOT_PRODUCT_TEXTURE_2D_NV, GL_DOT_PRODUCT_TEXTURE_CUBE_MAP_NV,
|
GL_DOT_PRODUCT_NV, GL_DOT_PRODUCT_TEXTURE_2D_NV, GL_DOT_PRODUCT_TEXTURE_CUBE_MAP_NV,
|
||||||
|
@ -101,10 +100,9 @@ static inline void convTexAddr(ITexture *tex, CMaterial::TTexAddressingMode mode
|
||||||
|
|
||||||
static const GLenum glTexCubeAddrModesNV[] =
|
static const GLenum glTexCubeAddrModesNV[] =
|
||||||
{
|
{
|
||||||
#ifdef USE_OPENGLES
|
GL_NONE, GL_TEXTURE_CUBE_MAP_ARB,
|
||||||
0, GL_TEXTURE_CUBE_MAP_OES
|
#ifndef USE_OPENGLES
|
||||||
#else
|
GL_PASS_THROUGH_NV, GL_CULL_FRAGMENT_NV,
|
||||||
GL_NONE, GL_TEXTURE_CUBE_MAP_ARB, GL_PASS_THROUGH_NV, GL_CULL_FRAGMENT_NV,
|
|
||||||
GL_OFFSET_TEXTURE_2D_NV, GL_OFFSET_TEXTURE_2D_SCALE_NV,
|
GL_OFFSET_TEXTURE_2D_NV, GL_OFFSET_TEXTURE_2D_SCALE_NV,
|
||||||
GL_DEPENDENT_AR_TEXTURE_2D_NV, GL_DEPENDENT_GB_TEXTURE_2D_NV,
|
GL_DEPENDENT_AR_TEXTURE_2D_NV, GL_DEPENDENT_GB_TEXTURE_2D_NV,
|
||||||
GL_DOT_PRODUCT_NV, GL_DOT_PRODUCT_TEXTURE_2D_NV, GL_DOT_PRODUCT_TEXTURE_CUBE_MAP_NV,
|
GL_DOT_PRODUCT_NV, GL_DOT_PRODUCT_TEXTURE_2D_NV, GL_DOT_PRODUCT_TEXTURE_CUBE_MAP_NV,
|
||||||
|
@ -147,11 +145,7 @@ void CDriverGL::setTextureEnvFunction(uint stage, CMaterial& mat)
|
||||||
{
|
{
|
||||||
// Cubic or normal ?
|
// Cubic or normal ?
|
||||||
if (text->isTextureCube ())
|
if (text->isTextureCube ())
|
||||||
#ifdef USE_OPENGLES
|
|
||||||
_DriverGLStates.setTexGenMode (stage, GL_REFLECTION_MAP_OES);
|
|
||||||
#else
|
|
||||||
_DriverGLStates.setTexGenMode (stage, GL_REFLECTION_MAP_ARB);
|
_DriverGLStates.setTexGenMode (stage, GL_REFLECTION_MAP_ARB);
|
||||||
#endif
|
|
||||||
else
|
else
|
||||||
#ifdef USE_OPENGLES
|
#ifdef USE_OPENGLES
|
||||||
_DriverGLStates.setTexGenMode (stage, GL_TEXTURE_CUBE_MAP_OES);
|
_DriverGLStates.setTexGenMode (stage, GL_TEXTURE_CUBE_MAP_OES);
|
||||||
|
@ -974,11 +968,7 @@ void CDriverGL::setupLightMapPass(uint pass)
|
||||||
if (mat._LightMapsMulx2)
|
if (mat._LightMapsMulx2)
|
||||||
{
|
{
|
||||||
// Multiply x 2
|
// Multiply x 2
|
||||||
#ifdef USE_OPENGLES
|
|
||||||
glTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE, 2);
|
|
||||||
#else
|
|
||||||
glTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, 2);
|
glTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, 2);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1087,11 +1077,7 @@ void CDriverGL::endLightMapMultiPass()
|
||||||
for (uint32 i = 0; i < (_NLightMapPerPass+1); ++i)
|
for (uint32 i = 0; i < (_NLightMapPerPass+1); ++i)
|
||||||
{
|
{
|
||||||
_DriverGLStates.activeTextureARB(i);
|
_DriverGLStates.activeTextureARB(i);
|
||||||
#ifdef USE_OPENGLES
|
|
||||||
glTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE, 1);
|
|
||||||
#else
|
|
||||||
glTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, 1);
|
glTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, 1);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1165,12 +1151,7 @@ void CDriverGL::setupSpecularBegin()
|
||||||
|
|
||||||
// todo hulud remove
|
// todo hulud remove
|
||||||
// _DriverGLStates.setTextureMode(CDriverGLStates::TextureCubeMap);
|
// _DriverGLStates.setTextureMode(CDriverGLStates::TextureCubeMap);
|
||||||
|
|
||||||
#ifdef USE_OPENGLES
|
|
||||||
_DriverGLStates.setTexGenMode (1, GL_REFLECTION_MAP_OES);
|
|
||||||
#else
|
|
||||||
_DriverGLStates.setTexGenMode (1, GL_REFLECTION_MAP_ARB);
|
_DriverGLStates.setTexGenMode (1, GL_REFLECTION_MAP_ARB);
|
||||||
#endif
|
|
||||||
|
|
||||||
// setup the good matrix for stage 1.
|
// setup the good matrix for stage 1.
|
||||||
glMatrixMode(GL_TEXTURE);
|
glMatrixMode(GL_TEXTURE);
|
||||||
|
|
|
@ -165,11 +165,9 @@ void CDriverGLStates::forceDefaults(uint nbStages)
|
||||||
|
|
||||||
if(_TextureCubeMapSupported)
|
if(_TextureCubeMapSupported)
|
||||||
{
|
{
|
||||||
#ifdef USE_OPENGLES
|
|
||||||
glDisable(GL_TEXTURE_CUBE_MAP_OES);
|
|
||||||
glDisable(GL_TEXTURE_GEN_STR_OES);
|
|
||||||
#else
|
|
||||||
glDisable(GL_TEXTURE_CUBE_MAP_ARB);
|
glDisable(GL_TEXTURE_CUBE_MAP_ARB);
|
||||||
|
#ifdef USE_OPENGLES
|
||||||
|
glDisable(GL_TEXTURE_GEN_STR_OES);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -393,6 +391,7 @@ void CDriverGLStates::enableMultisample(bool enable)
|
||||||
{
|
{
|
||||||
// new state.
|
// new state.
|
||||||
_CurMultisample= enable;
|
_CurMultisample= enable;
|
||||||
|
|
||||||
// Setup GLState.
|
// Setup GLState.
|
||||||
if(_CurMultisample)
|
if(_CurMultisample)
|
||||||
glEnable(GL_MULTISAMPLE_ARB);
|
glEnable(GL_MULTISAMPLE_ARB);
|
||||||
|
@ -686,7 +685,7 @@ void CDriverGLStates::setTexGenMode (uint stage, GLint mode)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef USE_OPENGLES
|
#ifdef USE_OPENGLES
|
||||||
// nglTexGeniOES(GL_TEXTURE_GEN_STR_OES, GL_TEXTURE_GEN_MODE_OES, mode);
|
nglTexGeniOES(GL_TEXTURE_GEN_STR_OES, GL_TEXTURE_GEN_MODE_OES, mode);
|
||||||
#else
|
#else
|
||||||
glTexGeni( GL_S, GL_TEXTURE_GEN_MODE, mode);
|
glTexGeni( GL_S, GL_TEXTURE_GEN_MODE, mode);
|
||||||
glTexGeni( GL_T, GL_TEXTURE_GEN_MODE, mode);
|
glTexGeni( GL_T, GL_TEXTURE_GEN_MODE, mode);
|
||||||
|
@ -702,8 +701,8 @@ void CDriverGLStates::setTexGenMode (uint stage, GLint mode)
|
||||||
#ifdef USE_OPENGLES
|
#ifdef USE_OPENGLES
|
||||||
// if(mode==GL_OBJECT_LINEAR || mode==GL_EYE_LINEAR)
|
// if(mode==GL_OBJECT_LINEAR || mode==GL_EYE_LINEAR)
|
||||||
// {
|
// {
|
||||||
nglTexGeniOES(GL_TEXTURE_GEN_STR_OES, GL_TEXTURE_GEN_MODE_OES, mode);
|
// nglTexGeniOES(GL_TEXTURE_GEN_STR_OES, GL_TEXTURE_GEN_MODE_OES, mode);
|
||||||
glEnable(GL_TEXTURE_GEN_STR_OES);
|
// glEnable(GL_TEXTURE_GEN_STR_OES);
|
||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
|
@ -742,11 +741,7 @@ void CDriverGLStates::resetTextureMode()
|
||||||
|
|
||||||
if (_TextureCubeMapSupported)
|
if (_TextureCubeMapSupported)
|
||||||
{
|
{
|
||||||
#ifdef USE_OPENGLES
|
|
||||||
glDisable(GL_TEXTURE_CUBE_MAP_OES);
|
|
||||||
#else
|
|
||||||
glDisable(GL_TEXTURE_CUBE_MAP_ARB);
|
glDisable(GL_TEXTURE_CUBE_MAP_ARB);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef USE_OPENGLES
|
#ifndef USE_OPENGLES
|
||||||
|
@ -789,11 +784,7 @@ void CDriverGLStates::setTextureMode(TTextureMode texMode)
|
||||||
{
|
{
|
||||||
if(_TextureCubeMapSupported)
|
if(_TextureCubeMapSupported)
|
||||||
{
|
{
|
||||||
#ifdef USE_OPENGLES
|
|
||||||
glDisable(GL_TEXTURE_CUBE_MAP_OES);
|
|
||||||
#else
|
|
||||||
glDisable(GL_TEXTURE_CUBE_MAP_ARB);
|
glDisable(GL_TEXTURE_CUBE_MAP_ARB);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -823,11 +814,7 @@ void CDriverGLStates::setTextureMode(TTextureMode texMode)
|
||||||
{
|
{
|
||||||
if(_TextureCubeMapSupported)
|
if(_TextureCubeMapSupported)
|
||||||
{
|
{
|
||||||
#ifdef USE_OPENGLES
|
|
||||||
glEnable(GL_TEXTURE_CUBE_MAP_OES);
|
|
||||||
#else
|
|
||||||
glEnable(GL_TEXTURE_CUBE_MAP_ARB);
|
glEnable(GL_TEXTURE_CUBE_MAP_ARB);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -872,11 +859,11 @@ void CDriverGLStates::forceActiveTextureARB(uint stage)
|
||||||
_CurrentActiveTextureARB= stage;
|
_CurrentActiveTextureARB= stage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
void CDriverGLStates::enableVertexArray(bool enable)
|
void CDriverGLStates::enableVertexArray(bool enable)
|
||||||
{
|
{
|
||||||
H_AUTO_OGL(CDriverGLStates_enableVertexArray)
|
H_AUTO_OGL(CDriverGLStates_enableVertexArray);
|
||||||
|
|
||||||
if(_VertexArrayEnabled != enable)
|
if(_VertexArrayEnabled != enable)
|
||||||
{
|
{
|
||||||
if(enable)
|
if(enable)
|
||||||
|
@ -1038,7 +1025,7 @@ void CDriverGLStates::enableVertexAttribArrayARB(uint glIndex,bool enable)
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
void CDriverGLStates::enableVertexAttribArrayForEXTVertexShader(uint glIndex, bool enable, uint *variants)
|
void CDriverGLStates::enableVertexAttribArrayForEXTVertexShader(uint glIndex, bool enable, uint *variants)
|
||||||
{
|
{
|
||||||
H_AUTO_OGL(CDriverGLStates_enableVertexAttribArrayForEXTVertexShader)
|
H_AUTO_OGL(CDriverGLStates_enableVertexAttribArrayForEXTVertexShader);
|
||||||
|
|
||||||
if(_VertexAttribArrayEnabled[glIndex] != enable)
|
if(_VertexAttribArrayEnabled[glIndex] != enable)
|
||||||
{
|
{
|
||||||
|
|
|
@ -781,11 +781,7 @@ void CDriverGL::bindTextureWithMode(ITexture &tex)
|
||||||
{
|
{
|
||||||
_DriverGLStates.setTextureMode(CDriverGLStates::TextureCubeMap);
|
_DriverGLStates.setTextureMode(CDriverGLStates::TextureCubeMap);
|
||||||
// Bind this texture
|
// Bind this texture
|
||||||
#ifdef USE_OPENGLES
|
|
||||||
glBindTexture(GL_TEXTURE_CUBE_MAP_OES, gltext->ID);
|
|
||||||
#else
|
|
||||||
glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, gltext->ID);
|
glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, gltext->ID);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -820,19 +816,13 @@ void CDriverGL::setupTextureBasicParameters(ITexture &tex)
|
||||||
{
|
{
|
||||||
if (_Extensions.ARBTextureCubeMap)
|
if (_Extensions.ARBTextureCubeMap)
|
||||||
{
|
{
|
||||||
#ifdef USE_OPENGLES
|
|
||||||
glTexParameteri(GL_TEXTURE_CUBE_MAP_OES,GL_TEXTURE_WRAP_S, translateWrapToGl(ITexture::Clamp, _Extensions));
|
|
||||||
glTexParameteri(GL_TEXTURE_CUBE_MAP_OES,GL_TEXTURE_WRAP_T, translateWrapToGl(ITexture::Clamp, _Extensions));
|
|
||||||
// glTexParameteri(GL_TEXTURE_CUBE_MAP_OES,GL_TEXTURE_WRAP_R, translateWrapToGl(ITexture::Clamp, _Extensions));
|
|
||||||
glTexParameteri(GL_TEXTURE_CUBE_MAP_OES,GL_TEXTURE_MAG_FILTER, translateMagFilterToGl(gltext));
|
|
||||||
glTexParameteri(GL_TEXTURE_CUBE_MAP_OES,GL_TEXTURE_MIN_FILTER, translateMinFilterToGl(gltext));
|
|
||||||
#else
|
|
||||||
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB,GL_TEXTURE_WRAP_S, translateWrapToGl(ITexture::Clamp, _Extensions));
|
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB,GL_TEXTURE_WRAP_S, translateWrapToGl(ITexture::Clamp, _Extensions));
|
||||||
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB,GL_TEXTURE_WRAP_T, translateWrapToGl(ITexture::Clamp, _Extensions));
|
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB,GL_TEXTURE_WRAP_T, translateWrapToGl(ITexture::Clamp, _Extensions));
|
||||||
|
#ifndef USE_OPENGLES
|
||||||
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB,GL_TEXTURE_WRAP_R, translateWrapToGl(ITexture::Clamp, _Extensions));
|
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB,GL_TEXTURE_WRAP_R, translateWrapToGl(ITexture::Clamp, _Extensions));
|
||||||
|
#endif
|
||||||
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB,GL_TEXTURE_MAG_FILTER, translateMagFilterToGl(gltext));
|
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB,GL_TEXTURE_MAG_FILTER, translateMagFilterToGl(gltext));
|
||||||
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB,GL_TEXTURE_MIN_FILTER, translateMinFilterToGl(gltext));
|
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB,GL_TEXTURE_MIN_FILTER, translateMinFilterToGl(gltext));
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1516,31 +1506,19 @@ bool CDriverGL::activateTexture(uint stage, ITexture *tex)
|
||||||
_CurrentTextureInfoGL[stage]= gltext;
|
_CurrentTextureInfoGL[stage]= gltext;
|
||||||
|
|
||||||
// setup this texture
|
// setup this texture
|
||||||
#ifdef USE_OPENGLES
|
|
||||||
glBindTexture(GL_TEXTURE_CUBE_MAP_OES, gltext->ID);
|
|
||||||
#else
|
|
||||||
glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, gltext->ID);
|
glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, gltext->ID);
|
||||||
#endif
|
|
||||||
|
|
||||||
// Change parameters of texture, if necessary.
|
// Change parameters of texture, if necessary.
|
||||||
//============================================
|
//============================================
|
||||||
if(gltext->MagFilter!= tex->getMagFilter())
|
if(gltext->MagFilter!= tex->getMagFilter())
|
||||||
{
|
{
|
||||||
gltext->MagFilter= tex->getMagFilter();
|
gltext->MagFilter= tex->getMagFilter();
|
||||||
#ifdef USE_OPENGLES
|
|
||||||
glTexParameteri(GL_TEXTURE_CUBE_MAP_OES,GL_TEXTURE_MAG_FILTER, translateMagFilterToGl(gltext));
|
|
||||||
#else
|
|
||||||
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB,GL_TEXTURE_MAG_FILTER, translateMagFilterToGl(gltext));
|
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB,GL_TEXTURE_MAG_FILTER, translateMagFilterToGl(gltext));
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
if(gltext->MinFilter!= tex->getMinFilter())
|
if(gltext->MinFilter!= tex->getMinFilter())
|
||||||
{
|
{
|
||||||
gltext->MinFilter= tex->getMinFilter();
|
gltext->MinFilter= tex->getMinFilter();
|
||||||
#ifdef USE_OPENGLES
|
|
||||||
glTexParameteri(GL_TEXTURE_CUBE_MAP_OES,GL_TEXTURE_MIN_FILTER, translateMinFilterToGl(gltext));
|
|
||||||
#else
|
|
||||||
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB,GL_TEXTURE_MIN_FILTER, translateMinFilterToGl(gltext));
|
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB,GL_TEXTURE_MIN_FILTER, translateMinFilterToGl(gltext));
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1617,34 +1595,16 @@ bool CDriverGL::activateTexture(uint stage, ITexture *tex)
|
||||||
|
|
||||||
|
|
||||||
// This maps the CMaterial::TTexOperator
|
// This maps the CMaterial::TTexOperator
|
||||||
static const GLenum OperatorLUT[9]= { GL_REPLACE, GL_MODULATE, GL_ADD,
|
static const GLenum OperatorLUT[9]= { GL_REPLACE, GL_MODULATE, GL_ADD, GL_ADD_SIGNED_EXT, GL_INTERPOLATE_EXT, GL_INTERPOLATE_EXT, GL_INTERPOLATE_EXT, GL_INTERPOLATE_EXT, GL_BUMP_ENVMAP_ATI };
|
||||||
#ifdef USE_OPENGLES
|
|
||||||
GL_ADD_SIGNED, GL_INTERPOLATE, GL_INTERPOLATE, GL_INTERPOLATE, GL_INTERPOLATE, GL_INTERPOLATE
|
|
||||||
#else
|
|
||||||
GL_ADD_SIGNED_EXT, GL_INTERPOLATE_EXT, GL_INTERPOLATE_EXT, GL_INTERPOLATE_EXT, GL_INTERPOLATE_EXT, GL_BUMP_ENVMAP_ATI
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
// This maps the CMaterial::TTexSource
|
// This maps the CMaterial::TTexSource
|
||||||
static const GLenum SourceLUT[4]= { GL_TEXTURE,
|
static const GLenum SourceLUT[4]= { GL_TEXTURE, GL_PREVIOUS_EXT, GL_PRIMARY_COLOR_EXT, GL_CONSTANT_EXT };
|
||||||
#ifdef USE_OPENGLES
|
|
||||||
GL_PREVIOUS, GL_PRIMARY_COLOR, GL_CONSTANT
|
|
||||||
#else
|
|
||||||
GL_PREVIOUS_EXT, GL_PRIMARY_COLOR_EXT, GL_CONSTANT_EXT
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
// This maps the CMaterial::TTexOperand
|
// This maps the CMaterial::TTexOperand
|
||||||
static const GLenum OperandLUT[4]= { GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA };
|
static const GLenum OperandLUT[4]= { GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA };
|
||||||
|
|
||||||
// This maps the CMaterial::TTexOperator, used for openGL Arg2 setup.
|
// This maps the CMaterial::TTexOperator, used for openGL Arg2 setup.
|
||||||
static const GLenum InterpolateSrcLUT[8]= { GL_TEXTURE, GL_TEXTURE, GL_TEXTURE, GL_TEXTURE, GL_TEXTURE,
|
static const GLenum InterpolateSrcLUT[8]= { GL_TEXTURE, GL_TEXTURE, GL_TEXTURE, GL_TEXTURE, GL_TEXTURE, GL_PREVIOUS_EXT, GL_PRIMARY_COLOR_EXT, GL_CONSTANT_EXT };
|
||||||
#ifdef USE_OPENGLES
|
|
||||||
GL_PREVIOUS, GL_PRIMARY_COLOR, GL_CONSTANT
|
|
||||||
#else
|
|
||||||
GL_PREVIOUS_EXT, GL_PRIMARY_COLOR_EXT, GL_CONSTANT_EXT
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
#ifndef USE_OPENGLES
|
#ifndef USE_OPENGLES
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue