Fix another bunch of deprecated function calls

This commit is contained in:
vlj 2014-09-26 22:39:53 +02:00
parent 032447bf30
commit 64a84f7e58
3 changed files with 26 additions and 19 deletions

View File

@ -2544,7 +2544,8 @@ bool COpenGLDriver::setActiveTexture(u32 stage, const video::ITexture* texture)
return false; return false;
} }
glEnable(GL_TEXTURE_2D); if (!useCoreContext)
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, glBindTexture(GL_TEXTURE_2D,
static_cast<const COpenGLTexture*>(texture)->getOpenGLTextureName()); static_cast<const COpenGLTexture*>(texture)->getOpenGLTextureName());
} }
@ -3878,38 +3879,42 @@ void COpenGLDriver::setFog(SColor c, E_FOG_TYPE fogType, f32 start,
{ {
CNullDriver::setFog(c, fogType, start, end, density, pixelFog, rangeFog); CNullDriver::setFog(c, fogType, start, end, density, pixelFog, rangeFog);
glFogf(GL_FOG_MODE, GLfloat((fogType==EFT_FOG_LINEAR)? GL_LINEAR : (fogType==EFT_FOG_EXP)?GL_EXP:GL_EXP2)); if (!useCoreContext)
glFogf(GL_FOG_MODE, GLfloat((fogType==EFT_FOG_LINEAR)? GL_LINEAR : (fogType==EFT_FOG_EXP)?GL_EXP:GL_EXP2));
#ifdef GL_EXT_fog_coord #ifdef GL_EXT_fog_coord
if (FeatureAvailable[IRR_EXT_fog_coord]) if (FeatureAvailable[IRR_EXT_fog_coord] && !useCoreContext)
glFogi(GL_FOG_COORDINATE_SOURCE, GL_FRAGMENT_DEPTH); glFogi(GL_FOG_COORDINATE_SOURCE, GL_FRAGMENT_DEPTH);
#endif #endif
#ifdef GL_NV_fog_distance #ifdef GL_NV_fog_distance
if (FeatureAvailable[IRR_NV_fog_distance]) if (FeatureAvailable[IRR_NV_fog_distance])
{ {
if (rangeFog) if (rangeFog && !useCoreContext)
glFogi(GL_FOG_DISTANCE_MODE_NV, GL_EYE_RADIAL_NV); glFogi(GL_FOG_DISTANCE_MODE_NV, GL_EYE_RADIAL_NV);
else else if (!useCoreContext)
glFogi(GL_FOG_DISTANCE_MODE_NV, GL_EYE_PLANE_ABSOLUTE_NV); glFogi(GL_FOG_DISTANCE_MODE_NV, GL_EYE_PLANE_ABSOLUTE_NV);
} }
#endif #endif
if (fogType==EFT_FOG_LINEAR) if (fogType==EFT_FOG_LINEAR)
{ {
glFogf(GL_FOG_START, start); if (!useCoreContext)
glFogf(GL_FOG_END, end); glFogf(GL_FOG_START, start);
if (!useCoreContext)
glFogf(GL_FOG_END, end);
} }
else else if (!useCoreContext)
glFogf(GL_FOG_DENSITY, density); glFogf(GL_FOG_DENSITY, density);
if (pixelFog) if (pixelFog && !useCoreContext)
glHint(GL_FOG_HINT, GL_NICEST); glHint(GL_FOG_HINT, GL_NICEST);
else else if (!useCoreContext)
glHint(GL_FOG_HINT, GL_FASTEST); glHint(GL_FOG_HINT, GL_FASTEST);
SColorf color(c); SColorf color(c);
GLfloat data[4] = {color.r, color.g, color.b, color.a}; GLfloat data[4] = {color.r, color.g, color.b, color.a};
glFogfv(GL_FOG_COLOR, data); if (!useCoreContext)
glFogfv(GL_FOG_COLOR, data);
} }

View File

@ -15,7 +15,7 @@ namespace irr
{ {
namespace video namespace video
{ {
extern bool useCoreContext;
//! Base class for all internal OpenGL material renderers //! Base class for all internal OpenGL material renderers
class COpenGLMaterialRenderer : public IMaterialRenderer class COpenGLMaterialRenderer : public IMaterialRenderer
{ {
@ -50,7 +50,8 @@ public:
{ {
// thanks to Murphy, the following line removed some // thanks to Murphy, the following line removed some
// bugs with several OpenGL implementations. // bugs with several OpenGL implementations.
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); if (!useCoreContext)
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
} }
} }
}; };

View File

@ -18,7 +18,7 @@ namespace irr
{ {
namespace video namespace video
{ {
extern bool useCoreContext;
//! constructor for usual textures //! constructor for usual textures
COpenGLTexture::COpenGLTexture(IImage* origImage, const io::path& name, void* mipmapData, COpenGLDriver* driver) COpenGLTexture::COpenGLTexture(IImage* origImage, const io::path& name, void* mipmapData, COpenGLDriver* driver)
: ITexture(name), ColorFormat(ECF_A8R8G8B8), Driver(driver), Image(0), MipImage(0), : ITexture(name), ColorFormat(ECF_A8R8G8B8), Driver(driver), Image(0), MipImage(0),
@ -350,12 +350,12 @@ void COpenGLTexture::uploadTexture(bool newTexture, void* mipmapData, u32 level)
// auto generate if possible and no mipmap data is given // auto generate if possible and no mipmap data is given
if (HasMipMaps && !mipmapData && Driver->queryFeature(EVDF_MIP_MAP_AUTO_UPDATE)) if (HasMipMaps && !mipmapData && Driver->queryFeature(EVDF_MIP_MAP_AUTO_UPDATE))
{ {
if (Driver->getTextureCreationFlag(ETCF_OPTIMIZED_FOR_SPEED)) if (Driver->getTextureCreationFlag(ETCF_OPTIMIZED_FOR_SPEED) && !useCoreContext)
glHint(GL_GENERATE_MIPMAP_HINT_SGIS, GL_FASTEST); glHint(GL_GENERATE_MIPMAP_HINT_SGIS, GL_FASTEST);
else if (Driver->getTextureCreationFlag(ETCF_OPTIMIZED_FOR_QUALITY)) else if (Driver->getTextureCreationFlag(ETCF_OPTIMIZED_FOR_QUALITY) && !useCoreContext)
glHint(GL_GENERATE_MIPMAP_HINT_SGIS, GL_NICEST); glHint(GL_GENERATE_MIPMAP_HINT_SGIS, GL_NICEST);
else else if (!useCoreContext)
glHint(GL_GENERATE_MIPMAP_HINT_SGIS, GL_DONT_CARE); glHint(GL_GENERATE_MIPMAP_HINT_SGIS, GL_DONT_CARE);
AutomaticMipmapUpdate=true; AutomaticMipmapUpdate=true;
@ -405,7 +405,8 @@ void COpenGLTexture::uploadTexture(bool newTexture, void* mipmapData, u32 level)
if (!MipmapLegacyMode && AutomaticMipmapUpdate) if (!MipmapLegacyMode && AutomaticMipmapUpdate)
{ {
glEnable(GL_TEXTURE_2D); if (!useCoreContext)
glEnable(GL_TEXTURE_2D);
Driver->extGlGenerateMipmap(GL_TEXTURE_2D); Driver->extGlGenerateMipmap(GL_TEXTURE_2D);
} }