Access to back buffer
You're supposed to expose it to IVideoDriver, it's the only way to access it... The other drivers can just do nothing.
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
I'm running into further problems.
When I do my initial render to the frame buffer (to copy into my RT system), I don't call beginScene() or endScene() to avoid it from being actually synced to the screen. This works perfectly fine (see my beautiful screenshot below with bloom)...
Except... calling ISceneManager::drawAll() causes this to appear in the MSVC output console:
Then, when I go to drop the device, calling drop() throws an access violation exception (again, I'm positive that this is directly related to the being/end scene issue, as putting those calls in solves the problem).
I'm half-tempted to just ignore these problems since everything else works perfectly, but why is this happening?
When I do my initial render to the frame buffer (to copy into my RT system), I don't call beginScene() or endScene() to avoid it from being actually synced to the screen. This works perfectly fine (see my beautiful screenshot below with bloom)...
Except... calling ISceneManager::drawAll() causes this to appear in the MSVC output console:
I'm positive that this is related to me not calling beginScene() and endScene() and not some other memory issue (putting begin and end scene back in gets rid of the problem right away).First-chance exception at 0x75b49617 in Postprocessing.exe: Microsoft C++ exception: long at memory location 0x0028f090.
Then, when I go to drop the device, calling drop() throws an access violation exception (again, I'm positive that this is directly related to the being/end scene issue, as putting those calls in solves the problem).
I'm half-tempted to just ignore these problems since everything else works perfectly, but why is this happening?
It turned out that the exception was due to me deleting a shader callback class, not realizing that it inherited IReferenceCounted. Everything else works, but I'm not copying the backbuffer anymore since you can't render in HDR using it (since the highest range format the backbuffer supports is A8R8G8B8).
So, no antialiasing under DX9 and HDR for the moment, unless you render to a bigger rendertarget?. This is a bit uncomfortable, to be honest.
In DX the rendertargets can be created with multisample and in floating point precison, the only issue seems to be that the RT isn't lockable, probably because it will only exist in the graphics card.
I don't know, this confuses me. Some places say RTT can't have multisample, other say it is posible.
At least, the MSDN says it is possible.
http://msdn.microsoft.com/en-us/library ... 85%29.aspx
In DX the rendertargets can be created with multisample and in floating point precison, the only issue seems to be that the RT isn't lockable, probably because it will only exist in the graphics card.
I don't know, this confuses me. Some places say RTT can't have multisample, other say it is posible.
At least, the MSDN says it is possible.
http://msdn.microsoft.com/en-us/library ... 85%29.aspx
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
I've been seeing the sources, and i've got a question regarding the back buffer and the usage of the textures and rendertargets. What is the diference between creating the RTT with the "CreateTexture" call, with the usage "RENDERTARGET TEXTURE" and the "CreateRenderTarget" call?
CreateTexture doesn't have multisampling, but CreateRenderTarget indeed seems to suport it.
CreateTexture doesn't have multisampling, but CreateRenderTarget indeed seems to suport it.
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Re: Access to back buffer
I rebuilt irrlicht and libs, but now I don't know what to do. What code should I use for make AA works with postprocessing?
Re: Access to back buffer
Search for a function in the forums which is able to copy and downsample the backbuffer to a rendertarget. This only works in DirectX, but it allows for multisampled postprocessing. Or else, look for a postprocessing that is able to make antialiasing, like FXAA or MLAA, or similar.
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Re: Access to back buffer
Just tried the opengl version of copyBackBufferTo with 1.7.3. and the blit fails with GL_INVALID_FRAMEBUFFER_OPERATION
Checked FBO status and its complete, so why should this error occur?
Checked FBO status and its complete, so why should this error occur?
Re: Access to back buffer
I had to change the code to get it to work:-
Code: Select all
bool COpenGLDriver::copyBackBufferTo(ITexture* dest) // To render target (which has a FB and texture)
{
GLenum error = 0;
error = glGetError(); // Clear any old error
//if (dest->getDriverType() != EDT_OPENGL)
// return false;
GLenum status = extGlCheckFramebufferStatus(GL_FRAMEBUFFER_EXT);
if ( status != GL_FRAMEBUFFER_COMPLETE )
goto returnFALSE;
#ifdef _DEBUG
static bool bDo = false;
if ( bDo )
{
glDisable(GL_BLEND);
error = glGetError();
if ( error != GL_NO_ERROR )
goto returnFALSE;
glDisable(GL_DEPTH_TEST);
error = glGetError();
if ( error != GL_NO_ERROR )
goto returnFALSE;
glDisable(GL_ALPHA_TEST);
error = glGetError();
if ( error != GL_NO_ERROR )
goto returnFALSE;
glDisable(GL_MULTISAMPLE_ARB);
error = glGetError();
if ( error != GL_NO_ERROR )
goto returnFALSE;
glDisable(GL_SAMPLE_ALPHA_TO_COVERAGE_ARB);
error = glGetError();
if ( error != GL_NO_ERROR )
goto returnFALSE;
// glEnable(GL_DEPTH_TEST);
// glDisable(GL_TEXTURE_2D);
}
#endif
GLint oldFBO = 0;
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &oldFBO);
error = glGetError();
COpenGLTexture* tex = (COpenGLTexture*)dest;
GLuint name = tex->getOpenGLTextureName();
core::dimension2du bSize = this->getScreenSize();
glReadBuffer(GL_BACK); // Moved to here else error, Robmar
error = glGetError();
extGlBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
error = glGetError();
extGlBindFramebuffer(GL_DRAW_FRAMEBUFFER, name);
error = glGetError();
extGlFramebufferTexture2D(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, name, 0); // Added this, Robmar
error = glGetError();
glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
error = glGetError();
extGlBlitFramebuffer( 0, 0, bSize.Width, bSize.Height,
0, 0, bSize.Width, bSize.Height,
GL_COLOR_BUFFER_BIT, GL_NEAREST);
error = glGetError();
extGlBindFramebuffer(GL_FRAMEBUFFER, oldFBO);
error = glGetError();
return true;
returnFALSE:
return false;
}