Commit 45a8e00f authored by cutealien's avatar cutealien

Fix a bunch of warnings (mostly about constructor initializer order)


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@4479 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 5f4c2795
...@@ -15,7 +15,7 @@ namespace video ...@@ -15,7 +15,7 @@ namespace video
//! Constructor of empty image //! Constructor of empty image
CImage::CImage(ECOLOR_FORMAT format, const core::dimension2d<u32>& size) CImage::CImage(ECOLOR_FORMAT format, const core::dimension2d<u32>& size)
:Data(0), Size(size), Format(format), DeleteMemory(true), IsCompressed(false), HasMipMaps(false) :Data(0), Size(size), Format(format), IsCompressed(false), HasMipMaps(false), DeleteMemory(true)
{ {
initData(); initData();
} }
...@@ -24,7 +24,7 @@ CImage::CImage(ECOLOR_FORMAT format, const core::dimension2d<u32>& size) ...@@ -24,7 +24,7 @@ CImage::CImage(ECOLOR_FORMAT format, const core::dimension2d<u32>& size)
//! Constructor from raw data //! Constructor from raw data
CImage::CImage(ECOLOR_FORMAT format, const core::dimension2d<u32>& size, void* data, CImage::CImage(ECOLOR_FORMAT format, const core::dimension2d<u32>& size, void* data,
bool ownForeignMemory, bool deleteForeignMemory, bool compressed, bool mipMaps) bool ownForeignMemory, bool deleteForeignMemory, bool compressed, bool mipMaps)
: Data(0), Size(size), Format(format), DeleteMemory(deleteForeignMemory), IsCompressed(compressed), HasMipMaps(mipMaps) : Data(0), Size(size), Format(format), IsCompressed(compressed), HasMipMaps(mipMaps), DeleteMemory(deleteForeignMemory)
{ {
if (ownForeignMemory) if (ownForeignMemory)
{ {
......
...@@ -505,11 +505,11 @@ COpenGLDriver::COpenGLDriver(const SIrrlichtCreationParameters& params, ...@@ -505,11 +505,11 @@ COpenGLDriver::COpenGLDriver(const SIrrlichtCreationParameters& params,
COpenGLDriver::COpenGLDriver(const SIrrlichtCreationParameters& params, COpenGLDriver::COpenGLDriver(const SIrrlichtCreationParameters& params,
io::IFileSystem* io, CIrrDeviceLinux* device) io::IFileSystem* io, CIrrDeviceLinux* device)
: CNullDriver(io, params.WindowSize), COpenGLExtensionHandler(), : CNullDriver(io, params.WindowSize), COpenGLExtensionHandler(),
CurrentRenderMode(ERM_NONE), ResetRenderStates(true), BridgeCalls(0), CurrentRenderMode(ERM_NONE), ResetRenderStates(true),
Transformation3DChanged(true), AntiAlias(params.AntiAlias), Transformation3DChanged(true), AntiAlias(params.AntiAlias),
RenderTargetTexture(0), CurrentRendertargetSize(0,0), RenderTargetTexture(0), CurrentRendertargetSize(0,0),
ColorFormat(ECF_R8G8B8), CurrentTarget(ERT_FRAME_BUFFER), Params(params), ColorFormat(ECF_R8G8B8), CurrentTarget(ERT_FRAME_BUFFER), Params(params),
BridgeCalls(0), X11Device(device), DeviceType(EIDT_X11) X11Device(device), DeviceType(EIDT_X11)
{ {
#ifdef _DEBUG #ifdef _DEBUG
setDebugName("COpenGLDriver"); setDebugName("COpenGLDriver");
...@@ -625,7 +625,7 @@ COpenGLDriver::~COpenGLDriver() ...@@ -625,7 +625,7 @@ COpenGLDriver::~COpenGLDriver()
if (CgContext) if (CgContext)
cgDestroyContext(CgContext); cgDestroyContext(CgContext);
#endif #endif
if (BridgeCalls) if (BridgeCalls)
delete BridgeCalls; delete BridgeCalls;
...@@ -685,10 +685,10 @@ bool COpenGLDriver::genericDriverInit() ...@@ -685,10 +685,10 @@ bool COpenGLDriver::genericDriverInit()
CurrentTexture.clear(); CurrentTexture.clear();
// load extensions // load extensions
initExtensions(Params.Stencilbuffer); initExtensions(Params.Stencilbuffer);
if (!BridgeCalls) if (!BridgeCalls)
BridgeCalls = new COpenGLCallBridge(this); BridgeCalls = new COpenGLCallBridge(this);
if (queryFeature(EVDF_ARB_GLSL)) if (queryFeature(EVDF_ARB_GLSL))
{ {
char buf[32]; char buf[32];
...@@ -764,7 +764,7 @@ bool COpenGLDriver::genericDriverInit() ...@@ -764,7 +764,7 @@ bool COpenGLDriver::genericDriverInit()
Quad2DIndices[3] = 0; Quad2DIndices[3] = 0;
Quad2DIndices[4] = 1; Quad2DIndices[4] = 1;
Quad2DIndices[5] = 2; Quad2DIndices[5] = 2;
Line2DIndices[0] = 0; Line2DIndices[0] = 0;
Line2DIndices[1] = 1; Line2DIndices[1] = 1;
...@@ -2505,7 +2505,7 @@ void COpenGLDriver::draw2DImage(const video::ITexture* texture, ...@@ -2505,7 +2505,7 @@ void COpenGLDriver::draw2DImage(const video::ITexture* texture,
Quad2DVertices[1].TCoords = core::vector2df(tcoords.LowerRightCorner.X, tcoords.UpperLeftCorner.Y); Quad2DVertices[1].TCoords = core::vector2df(tcoords.LowerRightCorner.X, tcoords.UpperLeftCorner.Y);
Quad2DVertices[2].TCoords = core::vector2df(tcoords.LowerRightCorner.X, tcoords.LowerRightCorner.Y); Quad2DVertices[2].TCoords = core::vector2df(tcoords.LowerRightCorner.X, tcoords.LowerRightCorner.Y);
Quad2DVertices[3].TCoords = core::vector2df(tcoords.UpperLeftCorner.X, tcoords.LowerRightCorner.Y); Quad2DVertices[3].TCoords = core::vector2df(tcoords.UpperLeftCorner.X, tcoords.LowerRightCorner.Y);
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, Quad2DIndices); glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, Quad2DIndices);
targetPos.X += sourceRects[currentIndex].getWidth(); targetPos.X += sourceRects[currentIndex].getWidth();
...@@ -3362,7 +3362,7 @@ void COpenGLDriver::setBasicRenderStates(const SMaterial& material, const SMater ...@@ -3362,7 +3362,7 @@ void COpenGLDriver::setBasicRenderStates(const SMaterial& material, const SMater
// be sure to leave in texture stage 0 // be sure to leave in texture stage 0
BridgeCalls->setActiveTexture(GL_TEXTURE0_ARB); BridgeCalls->setActiveTexture(GL_TEXTURE0_ARB);
} }
//! Compare in SMaterial doesn't check texture parameters, so we should call this on each OnRender call. //! Compare in SMaterial doesn't check texture parameters, so we should call this on each OnRender call.
void COpenGLDriver::setTextureRenderStates(const SMaterial& material, bool resetAllRenderstates, bool fixedPipeline) void COpenGLDriver::setTextureRenderStates(const SMaterial& material, bool resetAllRenderstates, bool fixedPipeline)
{ {
...@@ -3588,7 +3588,7 @@ void COpenGLDriver::setRenderStates2DMode(bool alpha, bool texture, bool alphaCh ...@@ -3588,7 +3588,7 @@ void COpenGLDriver::setRenderStates2DMode(bool alpha, bool texture, bool alphaCh
setTextureRenderStates(OverrideMaterial2D, false, true); setTextureRenderStates(OverrideMaterial2D, false, true);
else else
setTextureRenderStates(InitMaterial2D, false, true); setTextureRenderStates(InitMaterial2D, false, true);
Material.setTexture(0, const_cast<video::ITexture*>(CurrentTexture[0])); Material.setTexture(0, const_cast<video::ITexture*>(CurrentTexture[0]));
setTransform(ETS_TEXTURE_0, core::IdentityMatrix); setTransform(ETS_TEXTURE_0, core::IdentityMatrix);
// Due to the transformation change, the previous line would call a reset each frame // Due to the transformation change, the previous line would call a reset each frame
...@@ -5088,19 +5088,19 @@ const SMaterial& COpenGLDriver::getCurrentMaterial() const ...@@ -5088,19 +5088,19 @@ const SMaterial& COpenGLDriver::getCurrentMaterial() const
{ {
return Material; return Material;
} }
COpenGLCallBridge* COpenGLDriver::getBridgeCalls() const COpenGLCallBridge* COpenGLDriver::getBridgeCalls() const
{ {
return BridgeCalls; return BridgeCalls;
} }
#ifdef _IRR_COMPILE_WITH_CG_ #ifdef _IRR_COMPILE_WITH_CG_
const CGcontext& COpenGLDriver::getCgContext() const CGcontext& COpenGLDriver::getCgContext()
{ {
return CgContext; return CgContext;
} }
#endif #endif
COpenGLCallBridge::COpenGLCallBridge(COpenGLDriver* driver) : Driver(driver), COpenGLCallBridge::COpenGLCallBridge(COpenGLDriver* driver) : Driver(driver),
AlphaMode(GL_ALWAYS), AlphaRef(0.0f), AlphaTest(false), AlphaMode(GL_ALWAYS), AlphaRef(0.0f), AlphaTest(false),
BlendSource(GL_ONE), BlendDestination(GL_ZERO), Blend(false), BlendSource(GL_ONE), BlendDestination(GL_ZERO), Blend(false),
...@@ -5125,19 +5125,19 @@ COpenGLCallBridge::COpenGLCallBridge(COpenGLDriver* driver) : Driver(driver), ...@@ -5125,19 +5125,19 @@ COpenGLCallBridge::COpenGLCallBridge(COpenGLDriver* driver) : Driver(driver),
glCullFace(GL_BACK); glCullFace(GL_BACK);
glDisable(GL_CULL_FACE); glDisable(GL_CULL_FACE);
glDepthFunc(GL_LESS); glDepthFunc(GL_LESS);
glDepthMask(GL_TRUE); glDepthMask(GL_TRUE);
glDisable(GL_DEPTH_TEST); glDisable(GL_DEPTH_TEST);
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
if(Driver->MultiTextureExtension) if(Driver->MultiTextureExtension)
{ {
Driver->extGlActiveTexture(GL_TEXTURE0_ARB); Driver->extGlActiveTexture(GL_TEXTURE0_ARB);
Driver->extGlClientActiveTexture(GL_TEXTURE0_ARB); Driver->extGlClientActiveTexture(GL_TEXTURE0_ARB);
} }
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);
glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_VERTEX_ARRAY);
...@@ -5165,7 +5165,7 @@ void COpenGLCallBridge::setAlphaTest(bool enable) ...@@ -5165,7 +5165,7 @@ void COpenGLCallBridge::setAlphaTest(bool enable)
glEnable(GL_ALPHA_TEST); glEnable(GL_ALPHA_TEST);
else else
glDisable(GL_ALPHA_TEST); glDisable(GL_ALPHA_TEST);
AlphaTest = enable; AlphaTest = enable;
} }
} }
...@@ -5189,7 +5189,7 @@ void COpenGLCallBridge::setBlend(bool enable) ...@@ -5189,7 +5189,7 @@ void COpenGLCallBridge::setBlend(bool enable)
glEnable(GL_BLEND); glEnable(GL_BLEND);
else else
glDisable(GL_BLEND); glDisable(GL_BLEND);
Blend = enable; Blend = enable;
} }
} }
...@@ -5244,7 +5244,7 @@ void COpenGLCallBridge::setCullFaceFunc(GLenum mode) ...@@ -5244,7 +5244,7 @@ void COpenGLCallBridge::setCullFaceFunc(GLenum mode)
if(CullFaceMode != mode) if(CullFaceMode != mode)
{ {
glCullFace(mode); glCullFace(mode);
CullFaceMode = mode; CullFaceMode = mode;
} }
} }
...@@ -5257,7 +5257,7 @@ void COpenGLCallBridge::setCullFace(bool enable) ...@@ -5257,7 +5257,7 @@ void COpenGLCallBridge::setCullFace(bool enable)
glEnable(GL_CULL_FACE); glEnable(GL_CULL_FACE);
else else
glDisable(GL_CULL_FACE); glDisable(GL_CULL_FACE);
CullFace = enable; CullFace = enable;
} }
} }
...@@ -5267,11 +5267,11 @@ void COpenGLCallBridge::setDepthFunc(GLenum mode) ...@@ -5267,11 +5267,11 @@ void COpenGLCallBridge::setDepthFunc(GLenum mode)
if(DepthFunc != mode) if(DepthFunc != mode)
{ {
glDepthFunc(mode); glDepthFunc(mode);
DepthFunc = mode; DepthFunc = mode;
} }
} }
void COpenGLCallBridge::setDepthMask(bool enable) void COpenGLCallBridge::setDepthMask(bool enable)
{ {
if(DepthMask != enable) if(DepthMask != enable)
...@@ -5280,7 +5280,7 @@ void COpenGLCallBridge::setDepthMask(bool enable) ...@@ -5280,7 +5280,7 @@ void COpenGLCallBridge::setDepthMask(bool enable)
glDepthMask(GL_TRUE); glDepthMask(GL_TRUE);
else else
glDepthMask(GL_FALSE); glDepthMask(GL_FALSE);
DepthMask = enable; DepthMask = enable;
} }
} }
...@@ -5293,11 +5293,11 @@ void COpenGLCallBridge::setDepthTest(bool enable) ...@@ -5293,11 +5293,11 @@ void COpenGLCallBridge::setDepthTest(bool enable)
glEnable(GL_DEPTH_TEST); glEnable(GL_DEPTH_TEST);
else else
glDisable(GL_DEPTH_TEST); glDisable(GL_DEPTH_TEST);
DepthTest = enable; DepthTest = enable;
} }
} }
void COpenGLCallBridge::setMatrixMode(GLenum mode) void COpenGLCallBridge::setMatrixMode(GLenum mode)
{ {
if (MatrixMode != mode) if (MatrixMode != mode)
...@@ -5306,7 +5306,7 @@ void COpenGLCallBridge::setMatrixMode(GLenum mode) ...@@ -5306,7 +5306,7 @@ void COpenGLCallBridge::setMatrixMode(GLenum mode)
MatrixMode = mode; MatrixMode = mode;
} }
} }
void COpenGLCallBridge::setActiveTexture(GLenum texture) void COpenGLCallBridge::setActiveTexture(GLenum texture)
{ {
if (Driver->MultiTextureExtension && ActiveTexture != texture) if (Driver->MultiTextureExtension && ActiveTexture != texture)
...@@ -5324,7 +5324,7 @@ void COpenGLCallBridge::setClientActiveTexture(GLenum texture) ...@@ -5324,7 +5324,7 @@ void COpenGLCallBridge::setClientActiveTexture(GLenum texture)
ClientActiveTexture = texture; ClientActiveTexture = texture;
} }
} }
void COpenGLCallBridge::setTexture(u32 stage, bool fixedPipeline) void COpenGLCallBridge::setTexture(u32 stage, bool fixedPipeline)
{ {
if (stage < MATERIAL_MAX_TEXTURES) if (stage < MATERIAL_MAX_TEXTURES)
...@@ -5342,7 +5342,7 @@ void COpenGLCallBridge::setTexture(u32 stage, bool fixedPipeline) ...@@ -5342,7 +5342,7 @@ void COpenGLCallBridge::setTexture(u32 stage, bool fixedPipeline)
} }
else if(fixedPipeline) else if(fixedPipeline)
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);
TextureFixedPipeline[stage] = fixedPipeline; TextureFixedPipeline[stage] = fixedPipeline;
Texture[stage] = Driver->CurrentTexture[stage]; Texture[stage] = Driver->CurrentTexture[stage];
} }
......
...@@ -288,7 +288,7 @@ namespace video ...@@ -288,7 +288,7 @@ namespace video
//! Can be called by an IMaterialRenderer to make its work easier. //! Can be called by an IMaterialRenderer to make its work easier.
virtual void setBasicRenderStates(const SMaterial& material, const SMaterial& lastmaterial, virtual void setBasicRenderStates(const SMaterial& material, const SMaterial& lastmaterial,
bool resetAllRenderstates, bool fixedPipeline); bool resetAllRenderstates, bool fixedPipeline);
//! Compare in SMaterial doesn't check texture parameters, so we should call this on each OnRender call. //! Compare in SMaterial doesn't check texture parameters, so we should call this on each OnRender call.
virtual void setTextureRenderStates(const SMaterial& material, bool resetAllRenderstates, bool fixedPipeline); virtual void setTextureRenderStates(const SMaterial& material, bool resetAllRenderstates, bool fixedPipeline);
...@@ -419,10 +419,10 @@ namespace video ...@@ -419,10 +419,10 @@ namespace video
//! Get ZBuffer bits. //! Get ZBuffer bits.
GLenum getZBufferBits() const; GLenum getZBufferBits() const;
//! Get current material. //! Get current material.
const SMaterial& getCurrentMaterial() const; const SMaterial& getCurrentMaterial() const;
//! Get bridge calls. //! Get bridge calls.
COpenGLCallBridge* getBridgeCalls() const; COpenGLCallBridge* getBridgeCalls() const;
...@@ -432,8 +432,6 @@ namespace video ...@@ -432,8 +432,6 @@ namespace video
#endif #endif
private: private:
// Bridge calls.
COpenGLCallBridge* BridgeCalls;
//! clears the zbuffer and color buffer //! clears the zbuffer and color buffer
void clearBuffers(bool backBuffer, bool zBuffer, bool stencilBuffer, SColor color); void clearBuffers(bool backBuffer, bool zBuffer, bool stencilBuffer, SColor color);
...@@ -478,6 +476,9 @@ namespace video ...@@ -478,6 +476,9 @@ namespace video
void renderArray(const void* indexList, u32 primitiveCount, void renderArray(const void* indexList, u32 primitiveCount,
scene::E_PRIMITIVE_TYPE pType, E_INDEX_TYPE iType); scene::E_PRIMITIVE_TYPE pType, E_INDEX_TYPE iType);
// Bridge calls.
COpenGLCallBridge* BridgeCalls;
core::stringw Name; core::stringw Name;
core::matrix4 Matrices[ETS_COUNT]; core::matrix4 Matrices[ETS_COUNT];
core::array<u8> ColorBuffer; core::array<u8> ColorBuffer;
...@@ -630,10 +631,10 @@ namespace video ...@@ -630,10 +631,10 @@ namespace video
E_DEVICE_TYPE DeviceType; E_DEVICE_TYPE DeviceType;
}; };
//! This bridge between Irlicht pseudo OpenGL calls //! This bridge between Irlicht pseudo OpenGL calls
//! and true OpenGL calls. //! and true OpenGL calls.
class COpenGLCallBridge class COpenGLCallBridge
{ {
public: public:
...@@ -660,7 +661,7 @@ namespace video ...@@ -660,7 +661,7 @@ namespace video
void setCullFaceFunc(GLenum mode); void setCullFaceFunc(GLenum mode);
void setCullFace(bool enable); void setCullFace(bool enable);
// Depth calls. // Depth calls.
void setDepthFunc(GLenum mode); void setDepthFunc(GLenum mode);
...@@ -668,19 +669,19 @@ namespace video ...@@ -668,19 +669,19 @@ namespace video
void setDepthMask(bool enable); void setDepthMask(bool enable);
void setDepthTest(bool enable); void setDepthTest(bool enable);
// Matrix calls. // Matrix calls.
void setMatrixMode(GLenum mode); void setMatrixMode(GLenum mode);
// Texture calls. // Texture calls.
void setActiveTexture(GLenum texture); void setActiveTexture(GLenum texture);
void setClientActiveTexture(GLenum texture); void setClientActiveTexture(GLenum texture);
void setTexture(u32 stage, bool fixedPipeline); void setTexture(u32 stage, bool fixedPipeline);
private: private:
COpenGLDriver* Driver; COpenGLDriver* Driver;
...@@ -699,13 +700,13 @@ namespace video ...@@ -699,13 +700,13 @@ namespace video
GLenum CullFaceMode; GLenum CullFaceMode;
bool CullFace; bool CullFace;
GLenum DepthFunc; GLenum DepthFunc;
bool DepthMask; bool DepthMask;
bool DepthTest; bool DepthTest;
GLenum MatrixMode; GLenum MatrixMode;
GLenum ActiveTexture; GLenum ActiveTexture;
GLenum ClientActiveTexture; GLenum ClientActiveTexture;
......
...@@ -44,7 +44,7 @@ COpenGLSLMaterialRenderer::COpenGLSLMaterialRenderer(video::COpenGLDriver* drive ...@@ -44,7 +44,7 @@ COpenGLSLMaterialRenderer::COpenGLSLMaterialRenderer(video::COpenGLDriver* drive
IShaderConstantSetCallBack* callback, IShaderConstantSetCallBack* callback,
E_MATERIAL_TYPE baseMaterial, E_MATERIAL_TYPE baseMaterial,
s32 userData) s32 userData)
: Driver(driver), CallBack(callback), Program(0), Program2(0), BaseMaterial(0), UserData(userData) : Driver(driver), CallBack(callback), BaseMaterial(0), Program(0), Program2(0), UserData(userData)
{ {
#ifdef _DEBUG #ifdef _DEBUG
setDebugName("COpenGLSLMaterialRenderer"); setDebugName("COpenGLSLMaterialRenderer");
......
...@@ -24,8 +24,8 @@ COpenGLTexture::COpenGLTexture(IImage* origImage, const io::path& name, void* mi ...@@ -24,8 +24,8 @@ COpenGLTexture::COpenGLTexture(IImage* origImage, const io::path& name, void* mi
: ITexture(name), ColorFormat(ECF_A8R8G8B8), Driver(driver), Image(0), MipImage(0), : ITexture(name), ColorFormat(ECF_A8R8G8B8), Driver(driver), Image(0), MipImage(0),
TextureName(0), InternalFormat(GL_RGBA), PixelFormat(GL_BGRA_EXT), TextureName(0), InternalFormat(GL_RGBA), PixelFormat(GL_BGRA_EXT),
PixelType(GL_UNSIGNED_BYTE), MipLevelStored(0), MipmapLegacyMode(true), PixelType(GL_UNSIGNED_BYTE), MipLevelStored(0), MipmapLegacyMode(true),
IsRenderTarget(false), AutomaticMipmapUpdate(false), IsRenderTarget(false), IsCompressed(false), AutomaticMipmapUpdate(false),
ReadOnlyLock(false), KeepImage(true), IsCompressed(false) ReadOnlyLock(false), KeepImage(true)
{ {
#ifdef _DEBUG #ifdef _DEBUG
setDebugName("COpenGLTexture"); setDebugName("COpenGLTexture");
...@@ -35,7 +35,7 @@ COpenGLTexture::COpenGLTexture(IImage* origImage, const io::path& name, void* mi ...@@ -35,7 +35,7 @@ COpenGLTexture::COpenGLTexture(IImage* origImage, const io::path& name, void* mi
getImageValues(origImage); getImageValues(origImage);
if (ColorFormat == ECF_DXT1 || ColorFormat == ECF_DXT2 || ColorFormat == ECF_DXT3 || ColorFormat == ECF_DXT4 || ColorFormat == ECF_DXT5) if (ColorFormat == ECF_DXT1 || ColorFormat == ECF_DXT2 || ColorFormat == ECF_DXT3 || ColorFormat == ECF_DXT4 || ColorFormat == ECF_DXT5)
{ {
if(!Driver->queryFeature(EVDF_TEXTURE_COMPRESSED_DXT)) if(!Driver->queryFeature(EVDF_TEXTURE_COMPRESSED_DXT))
{ {
os::Printer::log("DXT texture compression not available.", ELL_ERROR); os::Printer::log("DXT texture compression not available.", ELL_ERROR);
...@@ -81,8 +81,8 @@ COpenGLTexture::COpenGLTexture(const io::path& name, COpenGLDriver* driver) ...@@ -81,8 +81,8 @@ COpenGLTexture::COpenGLTexture(const io::path& name, COpenGLDriver* driver)
: ITexture(name), ColorFormat(ECF_A8R8G8B8), Driver(driver), Image(0), MipImage(0), : ITexture(name), ColorFormat(ECF_A8R8G8B8), Driver(driver), Image(0), MipImage(0),
TextureName(0), InternalFormat(GL_RGBA), PixelFormat(GL_BGRA_EXT), TextureName(0), InternalFormat(GL_RGBA), PixelFormat(GL_BGRA_EXT),
PixelType(GL_UNSIGNED_BYTE), MipLevelStored(0), HasMipMaps(true), PixelType(GL_UNSIGNED_BYTE), MipLevelStored(0), HasMipMaps(true),
MipmapLegacyMode(true), IsRenderTarget(false), AutomaticMipmapUpdate(false), MipmapLegacyMode(true), IsRenderTarget(false), IsCompressed(false),
ReadOnlyLock(false), KeepImage(true), IsCompressed(false) AutomaticMipmapUpdate(false), ReadOnlyLock(false), KeepImage(true)
{ {
#ifdef _DEBUG #ifdef _DEBUG
setDebugName("COpenGLTexture"); setDebugName("COpenGLTexture");
...@@ -354,7 +354,7 @@ void COpenGLTexture::uploadTexture(bool newTexture, void* mipmapData, u32 level) ...@@ -354,7 +354,7 @@ void COpenGLTexture::uploadTexture(bool newTexture, void* mipmapData, u32 level)
// make sure we don't change the internal format of existing images // make sure we don't change the internal format of existing images
if (!newTexture) if (!newTexture)
InternalFormat=oldInternalFormat; InternalFormat=oldInternalFormat;
Driver->setActiveTexture(0, this); Driver->setActiveTexture(0, this);
Driver->getBridgeCalls()->setTexture(0, true); Driver->getBridgeCalls()->setTexture(0, true);
...@@ -399,7 +399,7 @@ void COpenGLTexture::uploadTexture(bool newTexture, void* mipmapData, u32 level) ...@@ -399,7 +399,7 @@ void COpenGLTexture::uploadTexture(bool newTexture, void* mipmapData, u32 level)
// enable bilinear filter without mipmaps // enable bilinear filter without mipmaps
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
StatesCache.BilinearFilter = true; StatesCache.BilinearFilter = true;
StatesCache.TrilinearFilter = false; StatesCache.TrilinearFilter = false;
StatesCache.MipMapStatus = false; StatesCache.MipMapStatus = false;
...@@ -460,10 +460,12 @@ void COpenGLTexture::uploadTexture(bool newTexture, void* mipmapData, u32 level) ...@@ -460,10 +460,12 @@ void COpenGLTexture::uploadTexture(bool newTexture, void* mipmapData, u32 level)
AutomaticMipmapUpdate=false; AutomaticMipmapUpdate=false;
if (IsCompressed && !mipmapData) if (IsCompressed && !mipmapData)
{
if (image->hasMipMaps()) if (image->hasMipMaps())
mipmapData = static_cast<u8*>(image->lock())+compressedDataSize; mipmapData = static_cast<u8*>(image->lock())+compressedDataSize;
else else
HasMipMaps = false; HasMipMaps = false;
}
regenerateMipMapLevels(mipmapData); regenerateMipMapLevels(mipmapData);
} }
...@@ -473,12 +475,12 @@ void COpenGLTexture::uploadTexture(bool newTexture, void* mipmapData, u32 level) ...@@ -473,12 +475,12 @@ void COpenGLTexture::uploadTexture(bool newTexture, void* mipmapData, u32 level)
// enable bilinear mipmap filter // enable bilinear mipmap filter
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
StatesCache.BilinearFilter = true; StatesCache.BilinearFilter = true;
StatesCache.TrilinearFilter = false; StatesCache.TrilinearFilter = false;
StatesCache.MipMapStatus = true; StatesCache.MipMapStatus = true;
} }
} }
if (Driver->testGLError()) if (Driver->testGLError())
os::Printer::log("Could not glTexImage2D", ELL_ERROR); os::Printer::log("Could not glTexImage2D", ELL_ERROR);
...@@ -823,22 +825,22 @@ COpenGLFBOTexture::COpenGLFBOTexture(const core::dimension2d<u32>& size, ...@@ -823,22 +825,22 @@ COpenGLFBOTexture::COpenGLFBOTexture(const core::dimension2d<u32>& size,
// generate color texture // generate color texture
glGenTextures(1, &TextureName); glGenTextures(1, &TextureName);
Driver->setActiveTexture(0, this); Driver->setActiveTexture(0, this);
Driver->getBridgeCalls()->setTexture(0, true); Driver->getBridgeCalls()->setTexture(0, true);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, FilteringType); 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_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
if(FilteringType == GL_NEAREST) if(FilteringType == GL_NEAREST)
StatesCache.BilinearFilter = false; StatesCache.BilinearFilter = false;
else else
StatesCache.BilinearFilter = true; StatesCache.BilinearFilter = true;
StatesCache.WrapU = ETC_CLAMP_TO_EDGE; StatesCache.WrapU = ETC_CLAMP_TO_EDGE;
StatesCache.WrapV = ETC_CLAMP_TO_EDGE; StatesCache.WrapV = ETC_CLAMP_TO_EDGE;
glTexImage2D(GL_TEXTURE_2D, 0, InternalFormat, ImageSize.Width, glTexImage2D(GL_TEXTURE_2D, 0, InternalFormat, ImageSize.Width,
ImageSize.Height, 0, PixelFormat, PixelType, 0); ImageSize.Height, 0, PixelFormat, PixelType, 0);
#ifdef _DEBUG #ifdef _DEBUG
......
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