Commit 163d0980 authored by hybrid's avatar hybrid

Some minor changes.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@767 dfc29bdd-3216-0410-991c-e03cc46cb475
parent ef444335
...@@ -328,17 +328,17 @@ ECOLOR_FORMAT CD3D9Texture::getColorFormatFromD3DFormat(D3DFORMAT format) ...@@ -328,17 +328,17 @@ ECOLOR_FORMAT CD3D9Texture::getColorFormatFromD3DFormat(D3DFORMAT format)
case D3DFMT_A1R5G5B5: case D3DFMT_A1R5G5B5:
Pitch = TextureSize.Width * 2; Pitch = TextureSize.Width * 2;
return ECF_A1R5G5B5; return ECF_A1R5G5B5;
break;
case D3DFMT_A8B8G8R8: case D3DFMT_A8B8G8R8:
case D3DFMT_A8R8G8B8: case D3DFMT_A8R8G8B8:
case D3DFMT_X8R8G8B8: case D3DFMT_X8R8G8B8:
Pitch = TextureSize.Width * 4; Pitch = TextureSize.Width * 4;
return ECF_A8R8G8B8; return ECF_A8R8G8B8;
break;
case D3DFMT_R5G6B5: case D3DFMT_R5G6B5:
Pitch = TextureSize.Width * 2; Pitch = TextureSize.Width * 2;
return ECF_R5G6B5; return ECF_R5G6B5;
break; case D3DFMT_R8G8B8:
Pitch = TextureSize.Width * 3;
return ECF_R8G8B8;
default: default:
return (ECOLOR_FORMAT)0; return (ECOLOR_FORMAT)0;
}; };
......
...@@ -339,7 +339,7 @@ ITexture* CNullDriver::getTexture(io::IReadFile* file) ...@@ -339,7 +339,7 @@ ITexture* CNullDriver::getTexture(io::IReadFile* file)
if (texture) if (texture)
return texture; return texture;
texture = loadTextureFromFile(file ); texture = loadTextureFromFile(file);
if (texture) if (texture)
{ {
...@@ -1205,8 +1205,8 @@ bool CNullDriver::writeImageToFile(IImage* image, const char* filename,u32 param ...@@ -1205,8 +1205,8 @@ bool CNullDriver::writeImageToFile(IImage* image, const char* filename,u32 param
//! Creates a software image from a byte array. //! Creates a software image from a byte array.
IImage* CNullDriver::createImageFromData(ECOLOR_FORMAT format, IImage* CNullDriver::createImageFromData(ECOLOR_FORMAT format,
const core::dimension2d<s32>& size, void *data, const core::dimension2d<s32>& size,
bool ownForeignMemory, void *data, bool ownForeignMemory,
bool deleteMemory) bool deleteMemory)
{ {
return new CImage(format, size, data, ownForeignMemory, deleteMemory); return new CImage(format, size, data, ownForeignMemory, deleteMemory);
......
...@@ -1738,7 +1738,7 @@ void COpenGLDriver::drawStencilShadowVolume(const core::vector3df* triangles, s3 ...@@ -1738,7 +1738,7 @@ void COpenGLDriver::drawStencilShadowVolume(const core::vector3df* triangles, s3
// The first parts are not correctly working, yet. // The first parts are not correctly working, yet.
#if 0 #if 0
#ifdef GL_EXT_stencil_two_side #ifdef GL_EXT_stencil_two_side
if (FeatureAvailable[IRR_EXT_stencil_two_side] && FeatureAvailable[IRR_EXT_stencil_wrap]) if (FeatureAvailable[IRR_EXT_stencil_two_side])
{ {
glEnable(GL_STENCIL_TEST_TWO_SIDE_EXT); glEnable(GL_STENCIL_TEST_TWO_SIDE_EXT);
#ifdef GL_NV_depth_clamp #ifdef GL_NV_depth_clamp
...@@ -1751,10 +1751,18 @@ void COpenGLDriver::drawStencilShadowVolume(const core::vector3df* triangles, s3 ...@@ -1751,10 +1751,18 @@ void COpenGLDriver::drawStencilShadowVolume(const core::vector3df* triangles, s3
// ZPASS Method // ZPASS Method
extGlActiveStencilFace(GL_BACK); extGlActiveStencilFace(GL_BACK);
if (FeatureAvailable[IRR_EXT_stencil_wrap])
glStencilOp(GL_KEEP, GL_KEEP, GL_DECR_WRAP_EXT); glStencilOp(GL_KEEP, GL_KEEP, GL_DECR_WRAP_EXT);
else
glStencilOp(GL_KEEP, GL_KEEP, GL_DECR);
glStencilMask(~0);
glStencilFunc(GL_ALWAYS, 0, ~0);
extGlActiveStencilFace(GL_FRONT); extGlActiveStencilFace(GL_FRONT);
if (FeatureAvailable[IRR_EXT_stencil_wrap])
glStencilOp(GL_KEEP, GL_KEEP, GL_INCR_WRAP_EXT); glStencilOp(GL_KEEP, GL_KEEP, GL_INCR_WRAP_EXT);
else
glStencilOp(GL_KEEP, GL_KEEP, GL_INCR);
glStencilMask(~0); glStencilMask(~0);
glStencilFunc(GL_ALWAYS, 0, ~0); glStencilFunc(GL_ALWAYS, 0, ~0);
...@@ -1765,12 +1773,18 @@ void COpenGLDriver::drawStencilShadowVolume(const core::vector3df* triangles, s3 ...@@ -1765,12 +1773,18 @@ void COpenGLDriver::drawStencilShadowVolume(const core::vector3df* triangles, s3
// ZFAIL Method // ZFAIL Method
extGlActiveStencilFace(GL_BACK); extGlActiveStencilFace(GL_BACK);
if (FeatureAvailable[IRR_EXT_stencil_wrap])
glStencilOp(GL_KEEP, GL_INCR_WRAP_EXT, GL_KEEP); glStencilOp(GL_KEEP, GL_INCR_WRAP_EXT, GL_KEEP);
else
glStencilOp(GL_KEEP, GL_INCR, GL_KEEP);
glStencilMask(~0); glStencilMask(~0);
glStencilFunc(GL_ALWAYS, 0, ~0); glStencilFunc(GL_ALWAYS, 0, ~0);
extGlActiveStencilFace(GL_FRONT); extGlActiveStencilFace(GL_FRONT);
if (FeatureAvailable[IRR_EXT_stencil_wrap])
glStencilOp(GL_KEEP, GL_DECR_WRAP_EXT, GL_KEEP); glStencilOp(GL_KEEP, GL_DECR_WRAP_EXT, GL_KEEP);
else
glStencilOp(GL_KEEP, GL_DECR, GL_KEEP);
glStencilMask(~0); glStencilMask(~0);
glStencilFunc(GL_ALWAYS, 0, ~0); glStencilFunc(GL_ALWAYS, 0, ~0);
...@@ -1789,6 +1803,7 @@ void COpenGLDriver::drawStencilShadowVolume(const core::vector3df* triangles, s3 ...@@ -1789,6 +1803,7 @@ void COpenGLDriver::drawStencilShadowVolume(const core::vector3df* triangles, s3
extGlStencilOpSeparate(GL_BACK, GL_KEEP, GL_KEEP, GL_DECR); extGlStencilOpSeparate(GL_BACK, GL_KEEP, GL_KEEP, GL_DECR);
extGlStencilOpSeparate(GL_FRONT, GL_KEEP, GL_KEEP, GL_INCR); extGlStencilOpSeparate(GL_FRONT, GL_KEEP, GL_KEEP, GL_INCR);
extGlStencilFuncSeparate(GL_FRONT_AND_BACK, GL_ALWAYS, 0, ~0); extGlStencilFuncSeparate(GL_FRONT_AND_BACK, GL_ALWAYS, 0, ~0);
glStencilMask(~0);
glDrawArrays(GL_TRIANGLES,0,count); glDrawArrays(GL_TRIANGLES,0,count);
} }
...@@ -2097,9 +2112,7 @@ bool COpenGLDriver::setRenderTarget(video::ITexture* texture, bool clearBackBuff ...@@ -2097,9 +2112,7 @@ bool COpenGLDriver::setRenderTarget(video::ITexture* texture, bool clearBackBuff
if (RenderTargetTexture!=0) if (RenderTargetTexture!=0)
{ {
if (RenderTargetTexture->isFrameBufferObject()) if (RenderTargetTexture->isFrameBufferObject())
{
RenderTargetTexture->unbindFrameBufferObject(); RenderTargetTexture->unbindFrameBufferObject();
}
else else
{ {
glBindTexture(GL_TEXTURE_2D, RenderTargetTexture->getOpenGLTextureName()); glBindTexture(GL_TEXTURE_2D, RenderTargetTexture->getOpenGLTextureName());
...@@ -2114,14 +2127,12 @@ bool COpenGLDriver::setRenderTarget(video::ITexture* texture, bool clearBackBuff ...@@ -2114,14 +2127,12 @@ bool COpenGLDriver::setRenderTarget(video::ITexture* texture, bool clearBackBuff
{ {
// we want to set a new target. so do this. // we want to set a new target. so do this.
glViewport(0, 0, texture->getSize().Width, texture->getSize().Height); glViewport(0, 0, texture->getSize().Width, texture->getSize().Height);
RenderTargetTexture = (COpenGLTexture*)texture; RenderTargetTexture = static_cast<COpenGLTexture*>(texture);
CurrentRendertargetSize = texture->getSize(); CurrentRendertargetSize = texture->getSize();
if (RenderTargetTexture->isFrameBufferObject()) if (RenderTargetTexture->isFrameBufferObject())
{
RenderTargetTexture->bindFrameBufferObject(); RenderTargetTexture->bindFrameBufferObject();
} }
}
else else
{ {
glViewport(0,0,ScreenSize.Width,ScreenSize.Height); glViewport(0,0,ScreenSize.Width,ScreenSize.Height);
......
...@@ -769,7 +769,7 @@ class COpenGLExtensionHandler ...@@ -769,7 +769,7 @@ class COpenGLExtensionHandler
#endif #endif
#ifdef PFNGLCOMPRESSEDTEXIMAGE2DPROC #ifdef PFNGLCOMPRESSEDTEXIMAGE2DPROC
PFNGLCOMPRESSEDTEXIMAGE2DPROC pGlCompressedTexImage2D; PFNGLCOMPRESSEDTEXIMAGE2DPROC pGlCompressedTexImage2D;
#endif // PFNGLCOMPRESSEDTEXIMAGE2DPROC #endif
#ifdef _IRR_WINDOWS_API_ #ifdef _IRR_WINDOWS_API_
typedef BOOL (APIENTRY *PFNWGLSWAPINTERVALFARPROC)(int); typedef BOOL (APIENTRY *PFNWGLSWAPINTERVALFARPROC)(int);
PFNWGLSWAPINTERVALFARPROC wglSwapIntervalEXT; PFNWGLSWAPINTERVALFARPROC wglSwapIntervalEXT;
......
...@@ -421,8 +421,7 @@ void COpenGLTexture::regenerateMipMapLevels() ...@@ -421,8 +421,7 @@ void COpenGLTexture::regenerateMipMapLevels()
return; return;
} }
// This code is wrong as it does not take into account the image scaling // Manually create mipmaps
// Therefore it is currently disabled
u32 width=ImageSize.Width>>1; u32 width=ImageSize.Width>>1;
u32 height=ImageSize.Height>>1; u32 height=ImageSize.Height>>1;
u32 i=1; u32 i=1;
......
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