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