Page 3 of 3

Posted: Wed Jul 21, 2010 5:39 am
by BlindSide
You're supposed to expose it to IVideoDriver, it's the only way to access it... The other drivers can just do nothing.

Posted: Sat Jul 31, 2010 4:27 pm
by slavik262
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)...

Image

Except... calling ISceneManager::drawAll() causes this to appear in the MSVC output console:
First-chance exception at 0x75b49617 in Postprocessing.exe: Microsoft C++ exception: long at memory location 0x0028f090.
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).

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?

Posted: Sat Oct 16, 2010 5:04 pm
by Mel
So, Is this actually working correctly?

Posted: Sat Oct 16, 2010 5:15 pm
by slavik262
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).

Posted: Sat Oct 16, 2010 10:40 pm
by Mel
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

Posted: Sun Oct 17, 2010 7:33 pm
by slavik262
I'm using MRT for deferred shading, so I can't use MSAA anyways.

Posted: Mon Oct 18, 2010 5:07 pm
by Mel
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.

Re: Access to back buffer

Posted: Wed Feb 01, 2012 10:25 pm
by dzordz
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

Posted: Mon Feb 06, 2012 11:56 am
by Mel
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.

Re: Access to back buffer

Posted: Fri May 03, 2013 1:55 pm
by robmar
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?

Re: Access to back buffer

Posted: Sat May 04, 2013 12:48 pm
by robmar
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;
 
}