forked from Mirrorlandia_minetest/irrlicht
master #5
@ -200,7 +200,6 @@ if(ENABLE_OPENGL3)
|
|||||||
if (NOT USE_SDL2)
|
if (NOT USE_SDL2)
|
||||||
message(FATAL_ERROR "OpenGL 3 driver requires SDL2")
|
message(FATAL_ERROR "OpenGL 3 driver requires SDL2")
|
||||||
endif()
|
endif()
|
||||||
set(OPENGL_DIRECT_LINK TRUE) # TODO
|
|
||||||
set(USE_SDLGL ON)
|
set(USE_SDLGL ON)
|
||||||
set(USE_SDLGL3 ON)
|
set(USE_SDLGL3 ON)
|
||||||
endif()
|
endif()
|
||||||
|
@ -7,6 +7,8 @@
|
|||||||
#include "SMaterial.h"
|
#include "SMaterial.h"
|
||||||
#include "ITexture.h"
|
#include "ITexture.h"
|
||||||
|
|
||||||
|
#include "mt_opengl.h"
|
||||||
|
|
||||||
namespace irr
|
namespace irr
|
||||||
{
|
{
|
||||||
namespace video
|
namespace video
|
||||||
@ -87,19 +89,19 @@ class COpenGLCoreCacheHandler
|
|||||||
|
|
||||||
if (curTextureType != prevTextureType)
|
if (curTextureType != prevTextureType)
|
||||||
{
|
{
|
||||||
glBindTexture(prevTextureType, 0);
|
GL.BindTexture(prevTextureType, 0);
|
||||||
|
|
||||||
#if ( defined(IRR_COMPILE_GL_COMMON) || defined(IRR_COMPILE_GLES_COMMON) )
|
#if ( defined(IRR_COMPILE_GL_COMMON) || defined(IRR_COMPILE_GLES_COMMON) )
|
||||||
glDisable(prevTextureType);
|
GL.Disable(prevTextureType);
|
||||||
glEnable(curTextureType);
|
GL.Enable(curTextureType);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#if ( defined(IRR_COMPILE_GL_COMMON) || defined(IRR_COMPILE_GLES_COMMON) )
|
#if ( defined(IRR_COMPILE_GL_COMMON) || defined(IRR_COMPILE_GLES_COMMON) )
|
||||||
else if (!prevTexture)
|
else if (!prevTexture)
|
||||||
glEnable(curTextureType);
|
GL.Enable(curTextureType);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
glBindTexture(curTextureType, static_cast<const TOpenGLTexture*>(texture)->getOpenGLTextureName());
|
GL.BindTexture(curTextureType, static_cast<const TOpenGLTexture*>(texture)->getOpenGLTextureName());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -115,10 +117,10 @@ class COpenGLCoreCacheHandler
|
|||||||
{
|
{
|
||||||
const GLenum prevTextureType = prevTexture->getOpenGLTextureType();
|
const GLenum prevTextureType = prevTexture->getOpenGLTextureType();
|
||||||
|
|
||||||
glBindTexture(prevTextureType, 0);
|
GL.BindTexture(prevTextureType, 0);
|
||||||
|
|
||||||
#if ( defined(IRR_COMPILE_GL_COMMON) || defined(IRR_COMPILE_GLES_COMMON) )
|
#if ( defined(IRR_COMPILE_GL_COMMON) || defined(IRR_COMPILE_GLES_COMMON) )
|
||||||
glDisable(prevTextureType);
|
GL.Disable(prevTextureType);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -222,28 +224,28 @@ public:
|
|||||||
ColorMask[i] = ECP_ALL;
|
ColorMask[i] = ECP_ALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
glBlendFunc(GL_ONE, GL_ZERO);
|
GL.BlendFunc(GL_ONE, GL_ZERO);
|
||||||
glDisable(GL_BLEND);
|
GL.Disable(GL_BLEND);
|
||||||
|
|
||||||
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
GL.ColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
||||||
|
|
||||||
glCullFace(CullFaceMode);
|
GL.CullFace(CullFaceMode);
|
||||||
glDisable(GL_CULL_FACE);
|
GL.Disable(GL_CULL_FACE);
|
||||||
|
|
||||||
glDepthFunc(DepthFunc);
|
GL.DepthFunc(DepthFunc);
|
||||||
glDepthMask(GL_TRUE);
|
GL.DepthMask(GL_TRUE);
|
||||||
glDisable(GL_DEPTH_TEST);
|
GL.Disable(GL_DEPTH_TEST);
|
||||||
|
|
||||||
Driver->irrGlActiveTexture(ActiveTexture);
|
Driver->irrGlActiveTexture(ActiveTexture);
|
||||||
|
|
||||||
#if ( defined(IRR_COMPILE_GL_COMMON) || defined(IRR_COMPILE_GLES_COMMON) )
|
#if ( defined(IRR_COMPILE_GL_COMMON) || defined(IRR_COMPILE_GLES_COMMON) )
|
||||||
glDisable(GL_TEXTURE_2D);
|
GL.Disable(GL_TEXTURE_2D);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const core::dimension2d<u32> ScreenSize = Driver->getScreenSize();
|
const core::dimension2d<u32> ScreenSize = Driver->getScreenSize();
|
||||||
ViewportWidth = ScreenSize.Width;
|
ViewportWidth = ScreenSize.Width;
|
||||||
ViewportHeight = ScreenSize.Height;
|
ViewportHeight = ScreenSize.Height;
|
||||||
glViewport(ViewportX, ViewportY, ViewportWidth, ViewportHeight);
|
GL.Viewport(ViewportX, ViewportY, ViewportWidth, ViewportHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~COpenGLCoreCacheHandler()
|
virtual ~COpenGLCoreCacheHandler()
|
||||||
@ -300,7 +302,7 @@ public:
|
|||||||
BlendSourceAlpha[0] != source || BlendDestinationAlpha[0] != destination ||
|
BlendSourceAlpha[0] != source || BlendDestinationAlpha[0] != destination ||
|
||||||
BlendFuncInvalid)
|
BlendFuncInvalid)
|
||||||
{
|
{
|
||||||
glBlendFunc(source, destination);
|
GL.BlendFunc(source, destination);
|
||||||
|
|
||||||
for (GLuint i = 0; i < FrameBufferCount; ++i)
|
for (GLuint i = 0; i < FrameBufferCount; ++i)
|
||||||
{
|
{
|
||||||
@ -383,9 +385,9 @@ public:
|
|||||||
if (Blend[0] != enable || BlendInvalid)
|
if (Blend[0] != enable || BlendInvalid)
|
||||||
{
|
{
|
||||||
if (enable)
|
if (enable)
|
||||||
glEnable(GL_BLEND);
|
GL.Enable(GL_BLEND);
|
||||||
else
|
else
|
||||||
glDisable(GL_BLEND);
|
GL.Disable(GL_BLEND);
|
||||||
|
|
||||||
for (GLuint i = 0; i < FrameBufferCount; ++i)
|
for (GLuint i = 0; i < FrameBufferCount; ++i)
|
||||||
Blend[i] = enable;
|
Blend[i] = enable;
|
||||||
@ -419,7 +421,7 @@ public:
|
|||||||
{
|
{
|
||||||
if (ColorMask[0] != mask || ColorMaskInvalid)
|
if (ColorMask[0] != mask || ColorMaskInvalid)
|
||||||
{
|
{
|
||||||
glColorMask((mask & ECP_RED) ? GL_TRUE : GL_FALSE, (mask & ECP_GREEN) ? GL_TRUE : GL_FALSE, (mask & ECP_BLUE) ? GL_TRUE : GL_FALSE, (mask & ECP_ALPHA) ? GL_TRUE : GL_FALSE);
|
GL.ColorMask((mask & ECP_RED) ? GL_TRUE : GL_FALSE, (mask & ECP_GREEN) ? GL_TRUE : GL_FALSE, (mask & ECP_BLUE) ? GL_TRUE : GL_FALSE, (mask & ECP_ALPHA) ? GL_TRUE : GL_FALSE);
|
||||||
|
|
||||||
for (GLuint i = 0; i < FrameBufferCount; ++i)
|
for (GLuint i = 0; i < FrameBufferCount; ++i)
|
||||||
ColorMask[i] = mask;
|
ColorMask[i] = mask;
|
||||||
@ -445,7 +447,7 @@ public:
|
|||||||
{
|
{
|
||||||
if (CullFaceMode != mode)
|
if (CullFaceMode != mode)
|
||||||
{
|
{
|
||||||
glCullFace(mode);
|
GL.CullFace(mode);
|
||||||
CullFaceMode = mode;
|
CullFaceMode = mode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -455,9 +457,9 @@ public:
|
|||||||
if (CullFace != enable)
|
if (CullFace != enable)
|
||||||
{
|
{
|
||||||
if (enable)
|
if (enable)
|
||||||
glEnable(GL_CULL_FACE);
|
GL.Enable(GL_CULL_FACE);
|
||||||
else
|
else
|
||||||
glDisable(GL_CULL_FACE);
|
GL.Disable(GL_CULL_FACE);
|
||||||
|
|
||||||
CullFace = enable;
|
CullFace = enable;
|
||||||
}
|
}
|
||||||
@ -469,7 +471,7 @@ public:
|
|||||||
{
|
{
|
||||||
if (DepthFunc != mode)
|
if (DepthFunc != mode)
|
||||||
{
|
{
|
||||||
glDepthFunc(mode);
|
GL.DepthFunc(mode);
|
||||||
DepthFunc = mode;
|
DepthFunc = mode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -484,9 +486,9 @@ public:
|
|||||||
if (DepthMask != enable)
|
if (DepthMask != enable)
|
||||||
{
|
{
|
||||||
if (enable)
|
if (enable)
|
||||||
glDepthMask(GL_TRUE);
|
GL.DepthMask(GL_TRUE);
|
||||||
else
|
else
|
||||||
glDepthMask(GL_FALSE);
|
GL.DepthMask(GL_FALSE);
|
||||||
|
|
||||||
DepthMask = enable;
|
DepthMask = enable;
|
||||||
}
|
}
|
||||||
@ -502,9 +504,9 @@ public:
|
|||||||
if (DepthTest != enable)
|
if (DepthTest != enable)
|
||||||
{
|
{
|
||||||
if (enable)
|
if (enable)
|
||||||
glEnable(GL_DEPTH_TEST);
|
GL.Enable(GL_DEPTH_TEST);
|
||||||
else
|
else
|
||||||
glDisable(GL_DEPTH_TEST);
|
GL.Disable(GL_DEPTH_TEST);
|
||||||
|
|
||||||
DepthTest = enable;
|
DepthTest = enable;
|
||||||
}
|
}
|
||||||
@ -572,7 +574,7 @@ public:
|
|||||||
{
|
{
|
||||||
if (ViewportX != viewportX || ViewportY != viewportY || ViewportWidth != viewportWidth || ViewportHeight != viewportHeight)
|
if (ViewportX != viewportX || ViewportY != viewportY || ViewportWidth != viewportWidth || ViewportHeight != viewportHeight)
|
||||||
{
|
{
|
||||||
glViewport(viewportX, viewportY, viewportWidth, viewportHeight);
|
GL.Viewport(viewportX, viewportY, viewportWidth, viewportHeight);
|
||||||
ViewportX = viewportX;
|
ViewportX = viewportX;
|
||||||
ViewportY = viewportY;
|
ViewportY = viewportY;
|
||||||
ViewportWidth = viewportWidth;
|
ViewportWidth = viewportWidth;
|
||||||
|
@ -12,10 +12,7 @@
|
|||||||
#include "CImage.h"
|
#include "CImage.h"
|
||||||
#include "CColorConverter.h"
|
#include "CColorConverter.h"
|
||||||
|
|
||||||
// Check if GL version we compile with should have the glGenerateMipmap function.
|
#include "mt_opengl.h"
|
||||||
#if defined(GL_VERSION_3_0) || defined(GL_ES_VERSION_2_0)
|
|
||||||
#define IRR_OPENGL_HAS_glGenerateMipmap
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace irr
|
namespace irr
|
||||||
{
|
{
|
||||||
@ -90,32 +87,23 @@ public:
|
|||||||
tmpImages = &Images;
|
tmpImages = &Images;
|
||||||
}
|
}
|
||||||
|
|
||||||
glGenTextures(1, &TextureName);
|
GL.GenTextures(1, &TextureName);
|
||||||
|
|
||||||
const COpenGLCoreTexture* prevTexture = Driver->getCacheHandler()->getTextureCache().get(0);
|
const COpenGLCoreTexture* prevTexture = Driver->getCacheHandler()->getTextureCache().get(0);
|
||||||
Driver->getCacheHandler()->getTextureCache().set(0, this);
|
Driver->getCacheHandler()->getTextureCache().set(0, this);
|
||||||
|
|
||||||
glTexParameteri(TextureType, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
GL.TexParameteri(TextureType, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||||
glTexParameteri(TextureType, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
GL.TexParameteri(TextureType, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||||
|
|
||||||
#ifdef GL_GENERATE_MIPMAP_HINT
|
#ifdef GL_GENERATE_MIPMAP_HINT
|
||||||
if (HasMipMaps)
|
if (HasMipMaps)
|
||||||
{
|
{
|
||||||
if (Driver->getTextureCreationFlag(ETCF_OPTIMIZED_FOR_SPEED))
|
if (Driver->getTextureCreationFlag(ETCF_OPTIMIZED_FOR_SPEED))
|
||||||
glHint(GL_GENERATE_MIPMAP_HINT, GL_FASTEST);
|
GL.Hint(GL_GENERATE_MIPMAP_HINT, GL_FASTEST);
|
||||||
else if (Driver->getTextureCreationFlag(ETCF_OPTIMIZED_FOR_QUALITY))
|
else if (Driver->getTextureCreationFlag(ETCF_OPTIMIZED_FOR_QUALITY))
|
||||||
glHint(GL_GENERATE_MIPMAP_HINT, GL_NICEST);
|
GL.Hint(GL_GENERATE_MIPMAP_HINT, GL_NICEST);
|
||||||
else
|
else
|
||||||
glHint(GL_GENERATE_MIPMAP_HINT, GL_DONT_CARE);
|
GL.Hint(GL_GENERATE_MIPMAP_HINT, GL_DONT_CARE);
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(IRR_OPENGL_HAS_glGenerateMipmap) && defined(GL_GENERATE_MIPMAP)
|
|
||||||
if (HasMipMaps)
|
|
||||||
{
|
|
||||||
LegacyAutoGenerateMipMaps = Driver->getTextureCreationFlag(ETCF_AUTO_GENERATE_MIP_MAPS) &&
|
|
||||||
Driver->queryFeature(EVDF_MIP_MAP_AUTO_UPDATE);
|
|
||||||
glTexParameteri(TextureType, GL_GENERATE_MIPMAP, LegacyAutoGenerateMipMaps ? GL_TRUE : GL_FALSE);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -174,19 +162,19 @@ public:
|
|||||||
os::Printer::log("COpenGLCoreTexture: Color format is not supported", ColorFormatNames[ColorFormat < ECF_UNKNOWN?ColorFormat:ECF_UNKNOWN], ELL_ERROR);
|
os::Printer::log("COpenGLCoreTexture: Color format is not supported", ColorFormatNames[ColorFormat < ECF_UNKNOWN?ColorFormat:ECF_UNKNOWN], ELL_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
glGenTextures(1, &TextureName);
|
GL.GenTextures(1, &TextureName);
|
||||||
|
|
||||||
const COpenGLCoreTexture* prevTexture = Driver->getCacheHandler()->getTextureCache().get(0);
|
const COpenGLCoreTexture* prevTexture = Driver->getCacheHandler()->getTextureCache().get(0);
|
||||||
Driver->getCacheHandler()->getTextureCache().set(0, this);
|
Driver->getCacheHandler()->getTextureCache().set(0, this);
|
||||||
|
|
||||||
|
|
||||||
glTexParameteri(TextureType, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
GL.TexParameteri(TextureType, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||||
glTexParameteri(TextureType, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
GL.TexParameteri(TextureType, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||||
glTexParameteri(TextureType, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
GL.TexParameteri(TextureType, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||||
glTexParameteri(TextureType, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
GL.TexParameteri(TextureType, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||||
|
|
||||||
#if defined(GL_VERSION_1_2)
|
#if defined(GL_VERSION_1_2)
|
||||||
glTexParameteri(TextureType, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
|
GL.TexParameteri(TextureType, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
StatesCache.WrapU = ETC_CLAMP_TO_EDGE;
|
StatesCache.WrapU = ETC_CLAMP_TO_EDGE;
|
||||||
@ -196,15 +184,15 @@ public:
|
|||||||
switch (Type)
|
switch (Type)
|
||||||
{
|
{
|
||||||
case ETT_2D:
|
case ETT_2D:
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, InternalFormat, Size.Width, Size.Height, 0, PixelFormat, PixelType, 0);
|
GL.TexImage2D(GL_TEXTURE_2D, 0, InternalFormat, Size.Width, Size.Height, 0, PixelFormat, PixelType, 0);
|
||||||
break;
|
break;
|
||||||
case ETT_CUBEMAP:
|
case ETT_CUBEMAP:
|
||||||
glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, InternalFormat, Size.Width, Size.Height, 0, PixelFormat, PixelType, 0);
|
GL.TexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, InternalFormat, Size.Width, Size.Height, 0, PixelFormat, PixelType, 0);
|
||||||
glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, InternalFormat, Size.Width, Size.Height, 0, PixelFormat, PixelType, 0);
|
GL.TexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, InternalFormat, Size.Width, Size.Height, 0, PixelFormat, PixelType, 0);
|
||||||
glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, InternalFormat, Size.Width, Size.Height, 0, PixelFormat, PixelType, 0);
|
GL.TexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, InternalFormat, Size.Width, Size.Height, 0, PixelFormat, PixelType, 0);
|
||||||
glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, InternalFormat, Size.Width, Size.Height, 0, PixelFormat, PixelType, 0);
|
GL.TexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, InternalFormat, Size.Width, Size.Height, 0, PixelFormat, PixelType, 0);
|
||||||
glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, InternalFormat, Size.Width, Size.Height, 0, PixelFormat, PixelType, 0);
|
GL.TexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, InternalFormat, Size.Width, Size.Height, 0, PixelFormat, PixelType, 0);
|
||||||
glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, InternalFormat, Size.Width, Size.Height, 0, PixelFormat, PixelType, 0);
|
GL.TexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, InternalFormat, Size.Width, Size.Height, 0, PixelFormat, PixelType, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -220,7 +208,7 @@ public:
|
|||||||
virtual ~COpenGLCoreTexture()
|
virtual ~COpenGLCoreTexture()
|
||||||
{
|
{
|
||||||
if (TextureName)
|
if (TextureName)
|
||||||
glDeleteTextures(1, &TextureName);
|
GL.DeleteTextures(1, &TextureName);
|
||||||
|
|
||||||
if (LockImage)
|
if (LockImage)
|
||||||
LockImage->drop();
|
LockImage->drop();
|
||||||
@ -278,7 +266,7 @@ public:
|
|||||||
tmpTextureType = GL_TEXTURE_CUBE_MAP_POSITIVE_X + layer;
|
tmpTextureType = GL_TEXTURE_CUBE_MAP_POSITIVE_X + layer;
|
||||||
}
|
}
|
||||||
|
|
||||||
glGetTexImage(tmpTextureType, MipLevelStored, PixelFormat, PixelType, tmpImage->getData());
|
GL.GetTexImage(tmpTextureType, MipLevelStored, PixelFormat, PixelType, tmpImage->getData());
|
||||||
Driver->testGLError(__LINE__);
|
Driver->testGLError(__LINE__);
|
||||||
|
|
||||||
if (IsRenderTarget && lockFlags == ETLF_FLIP_Y_UP_RTT)
|
if (IsRenderTarget && lockFlags == ETLF_FLIP_Y_UP_RTT)
|
||||||
@ -321,12 +309,12 @@ public:
|
|||||||
|
|
||||||
Driver->irrGlFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tmpTexture->getOpenGLTextureName(), 0);
|
Driver->irrGlFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tmpTexture->getOpenGLTextureName(), 0);
|
||||||
|
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
GL.Clear(GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
Driver->draw2DImage(this, layer, true);
|
Driver->draw2DImage(this, layer, true);
|
||||||
|
|
||||||
IImage* tmpImage = Driver->createImage(ECF_A8R8G8B8, Size);
|
IImage* tmpImage = Driver->createImage(ECF_A8R8G8B8, Size);
|
||||||
glReadPixels(0, 0, Size.Width, Size.Height, GL_RGBA, GL_UNSIGNED_BYTE, tmpImage->getData());
|
GL.ReadPixels(0, 0, Size.Width, Size.Height, GL_RGBA, GL_UNSIGNED_BYTE, tmpImage->getData());
|
||||||
|
|
||||||
Driver->getCacheHandler()->setFBO(prevFBO);
|
Driver->getCacheHandler()->setFBO(prevFBO);
|
||||||
Driver->getCacheHandler()->setViewport(prevViewportX, prevViewportY, prevViewportWidth, prevViewportHeight);
|
Driver->getCacheHandler()->setViewport(prevViewportX, prevViewportY, prevViewportWidth, prevViewportHeight);
|
||||||
@ -428,9 +416,7 @@ public:
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef IRR_OPENGL_HAS_glGenerateMipmap
|
|
||||||
Driver->irrGlGenerateMipmap(TextureType);
|
Driver->irrGlGenerateMipmap(TextureType);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Driver->getCacheHandler()->getTextureCache().set(0, prevTexture);
|
Driver->getCacheHandler()->getTextureCache().set(0, prevTexture);
|
||||||
@ -595,9 +581,9 @@ protected:
|
|||||||
case GL_TEXTURE_2D:
|
case GL_TEXTURE_2D:
|
||||||
case GL_TEXTURE_CUBE_MAP:
|
case GL_TEXTURE_CUBE_MAP:
|
||||||
if (initTexture)
|
if (initTexture)
|
||||||
glTexImage2D(tmpTextureType, level, InternalFormat, width, height, 0, PixelFormat, PixelType, tmpData);
|
GL.TexImage2D(tmpTextureType, level, InternalFormat, width, height, 0, PixelFormat, PixelType, tmpData);
|
||||||
else
|
else
|
||||||
glTexSubImage2D(tmpTextureType, level, 0, 0, width, height, PixelFormat, PixelType, tmpData);
|
GL.TexSubImage2D(tmpTextureType, level, 0, 0, width, height, PixelFormat, PixelType, tmpData);
|
||||||
Driver->testGLError(__LINE__);
|
Driver->testGLError(__LINE__);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -44,6 +44,7 @@ bool COpenGLDriver::initDriver()
|
|||||||
ContextManager->generateContext();
|
ContextManager->generateContext();
|
||||||
ExposedData = ContextManager->getContext();
|
ExposedData = ContextManager->getContext();
|
||||||
ContextManager->activateContext(ExposedData, false);
|
ContextManager->activateContext(ExposedData, false);
|
||||||
|
GL.LoadAllProcedures(ContextManager);
|
||||||
|
|
||||||
genericDriverInit();
|
genericDriverInit();
|
||||||
|
|
||||||
@ -51,8 +52,6 @@ bool COpenGLDriver::initDriver()
|
|||||||
extGlSwapInterval(Params.Vsync ? 1 : 0);
|
extGlSwapInterval(Params.Vsync ? 1 : 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
GL.LoadAllProcedures(ContextManager);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user