Commit 966e05b5 authored by nadro's avatar nadro

- Added getters to IRenderTarget interface.

- Improved D24S8 color format handling in OpenGL.
- Fixed issue with wrong size for OpenGL RT when FBO isn't available. Thx CuteAlien for report that.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5222 dfc29bdd-3216-0410-991c-e03cc46cb475
parent bc9fe27e
......@@ -25,6 +25,18 @@ namespace video
{
}
//! Returns an array of previously set textures.
const core::array<ITexture*>& getTexture() const
{
return Texture;
}
//! Returns a of previously set depth / depth-stencil texture.
ITexture* getDepthStencil() const
{
return DepthStencil;
}
//! Set multiple textures.
/** Set multiple textures for the render target.
\param texture Array of texture objects. These textures are used for a color outputs.
......
......@@ -3636,11 +3636,7 @@ ITexture* COpenGLDriver::addRenderTargetTexture(const core::dimension2d<u32>& si
bool generateMipLevels = getTextureCreationFlag(ETCF_CREATE_MIP_MAPS);
setTextureCreationFlag(ETCF_CREATE_MIP_MAPS, false);
bool supportForFBO = false;
#if defined(GL_VERSION_3_0) || defined(GL_ARB_framebuffer_object) || defined(GL_EXT_framebuffer_object)
supportForFBO = FeatureAvailable[IRR_EXT_framebuffer_object] || FeatureAvailable[IRR_ARB_framebuffer_object];
#endif
bool supportForFBO = (Feature.ColorAttachment > 0);
core::dimension2du destSize(size);
......@@ -3650,7 +3646,7 @@ ITexture* COpenGLDriver::addRenderTargetTexture(const core::dimension2d<u32>& si
destSize = destSize.getOptimalSize((size == size.getOptimalSize()), false, false);
}
COpenGLTexture* renderTargetTexture = new COpenGLTexture(name, size, format, this);
COpenGLTexture* renderTargetTexture = new COpenGLTexture(name, destSize, format, this);
addTexture(renderTargetTexture);
renderTargetTexture->drop();
......@@ -4078,14 +4074,23 @@ void COpenGLDriver::getColorFormatParameters(ECOLOR_FORMAT format, GLint& intern
case ECF_D16:
internalFormat = GL_DEPTH_COMPONENT16;
pixelFormat = GL_DEPTH_COMPONENT;
pixelType = GL_UNSIGNED_BYTE;
pixelType = GL_UNSIGNED_SHORT;
break;
case ECF_D32:
internalFormat = GL_DEPTH_COMPONENT32;
pixelFormat = GL_DEPTH_COMPONENT;
pixelType = GL_UNSIGNED_BYTE;
pixelType = GL_UNSIGNED_INT;
break;
case ECF_D24S8:
#ifdef GL_VERSION_3_0
if (Version >= 300)
{
internalFormat = GL_DEPTH_STENCIL;
pixelFormat = GL_DEPTH_STENCIL;
pixelType = GL_UNSIGNED_INT_24_8;
}
else
#endif
#ifdef GL_EXT_packed_depth_stencil
if (queryOpenGLFeature(COpenGLExtensionHandler::IRR_EXT_packed_depth_stencil))
{
......
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