Commit e0952a9c authored by nadro's avatar nadro

- Partially improved active texture handling in OpenGL (cause some issues with...

- Partially improved active texture handling in OpenGL (cause some issues with 2D rendering visible in example no. 11).

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@4408 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 06193571
This diff is collapsed.
......@@ -275,7 +275,14 @@ namespace video
//! Can be called by an IMaterialRenderer to make its work easier.
virtual void setBasicRenderStates(const SMaterial& material, const SMaterial& lastmaterial,
bool resetAllRenderstates);
bool resetAllRenderstates)
{
setBasicRenderStates(material, lastmaterial, resetAllRenderstates, true);
}
//! Can be called by an IMaterialRenderer to make its work easier.
virtual void setBasicRenderStates(const SMaterial& material, const SMaterial& lastmaterial,
bool resetAllRenderstates, bool fixedPipeline);
//! Get a vertex shader constant index.
virtual s32 getVertexShaderConstantID(const c8* name);
......@@ -577,8 +584,6 @@ namespace video
GLenum CurrentMatrixMode;
GLenum CurrentActiveTexture;
s8 CacheLODBias[MATERIAL_MAX_TEXTURES];
//! All the lights that have been requested; a hardware limited
//! number of them will be used at once.
struct RequestedLight
......
......@@ -227,7 +227,7 @@ void COpenGLSLMaterialRenderer::OnSetMaterial(const video::SMaterial& material,
if (CallBack)
CallBack->OnSetMaterial(material);
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates, false);
}
......@@ -502,7 +502,7 @@ void COpenGLSLMaterialRenderer::setBasicRenderStates(const SMaterial& material,
bool resetAllRenderstates)
{
// forward
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates, false);
}
s32 COpenGLSLMaterialRenderer::getVertexShaderConstantID(const c8* name)
......
......@@ -317,6 +317,13 @@ void COpenGLTexture::uploadTexture(bool newTexture, void* mipmapData, u32 level)
InternalFormat=oldInternalFormat;
Driver->setActiveTexture(0, this);
if (Driver->MultiTextureExtension)
Driver->setGlActiveTexture(GL_TEXTURE0_ARB);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, TextureName);
if (Driver->testGLError())
os::Printer::log("Could not bind Texture", ELL_ERROR);
......@@ -652,6 +659,12 @@ void COpenGLTexture::unbindRTT()
{
Driver->setActiveTexture(0, this);
if (Driver->MultiTextureExtension)
Driver->setGlActiveTexture(GL_TEXTURE0_ARB);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, TextureName);
// Copy Our ViewPort To The Texture
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, getSize().Width, getSize().Height);
}
......@@ -701,6 +714,12 @@ COpenGLFBOTexture::COpenGLFBOTexture(const core::dimension2d<u32>& size,
// generate color texture
glGenTextures(1, &TextureName);
Driver->setActiveTexture(0, this);
if (Driver->MultiTextureExtension)
Driver->setGlActiveTexture(GL_TEXTURE0_ARB);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, TextureName);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, FilteringType);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
......
......@@ -56,7 +56,7 @@ public:
struct SStatesCache
{
SStatesCache() : WrapU(ETC_REPEAT), WrapV(ETC_REPEAT), BilinearFilter(true),
TrilinearFilter(false), AnisotropicFilter(0), MipMapStatus(true), IsCached(false)
TrilinearFilter(false), AnisotropicFilter(0), MipMapStatus(true), IsCached(false), LODBias(0)
{
}
......@@ -66,6 +66,7 @@ public:
bool TrilinearFilter;
u8 AnisotropicFilter;
bool MipMapStatus;
s8 LODBias;
bool IsCached;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment