Dolphin, the GameCube and Wii emulator - Forums

Full Version: [fix] Fragile (and maybe others), source included
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5
LuisR14 that just causes OpenGL to render black Tongue

LuisR14

woops left something in "comments" Tongue (but why not just use my version (in my previous post))

Code:
// [ fix for Fragile by kamui_kun ...
bool Renderer::IsBlack()
{
    char pixels [3];
    int x, y;
    
    for( y = 0; y < (int)OpenGL_GetBackbufferHeight(); y++ ) {
        for( x = 0; x < (int)OpenGL_GetBackbufferWidth(); x++ ) {
            glReadPixels( x, y, 1, 1, GL_RED, GL_BYTE, &pixels[0]);
            glReadPixels( x, y, 1, 1, GL_GREEN, GL_BYTE, &pixels[1]);
            glReadPixels( x, y, 1, 1, GL_BLUE, GL_BYTE, &pixels[2]);
            if( (pixels[0] != 0) || (pixels[1] != 0) || (pixels[2] != 0) )
                return false;
        }
    }
    return true;
}

void Renderer::SwapBuffers()
{
    // [ fix for Fragile by kamui_kun ...
    bool pass = false;
    
    if( Renderer::IsBlack() )
        pass = true;
    
    // ...]
    
    ...
    
    if( !pass )
        OpenGL_SwapBuffers();
    
    ...
}
I haven't Fragile but for other game emu is 100% on my CPU and the screen is blak.
Yeah as i said it causes the rendering to stay black.

LuisR14

hmm strange Undecided, i'm gonna have to look more into it later Undecided
This is what causes it

for( y = 0; y < (int)OpenGL_GetBackbufferHeight(); y++ ) {
for( x = 0; x < (int)OpenGL_GetBackbufferWidth(); x++ ) {

LuisR14

that shouldn't be causing it, since it's doing it correctly Undecided
lReadPixels( x, y, 1, 1, GL_RED, GL_BYTE, &pixels[0]); << it doesn't like it

LuisR14

hmmm, might you try this Undecided

Code:
// [ fix for Fragile by kamui_kun ...
bool Renderer::IsBlack()
{
    char pixels [3] = {'', '', ''};
    int x, y;
    
    for( y = 0; y < (int)OpenGL_GetBackbufferHeight(); y++ ) {
        for( x = 0; x < (int)OpenGL_GetBackbufferWidth(); x++ ) {
            glReadPixels( x, y, 1, 1, GL_RED, GL_BYTE, &pixels[0]);
            glReadPixels( x, y, 1, 1, GL_GREEN, GL_BYTE, &pixels[1]);
            glReadPixels( x, y, 1, 1, GL_BLUE, GL_BYTE, &pixels[2]);
            if( (pixels[0] != 0) || (pixels[1] != 0) || (pixels[2] != 0) )
                return false;
        }
    }
    return true;
}

void Renderer::SwapBuffers()
{
    // [ fix for Fragile by kamui_kun ...
    bool pass = false;
    
    if( Renderer::IsBlack() )
        pass = true;
    
    // ...]
    
    ...
    
    if( !pass )
        OpenGL_SwapBuffers();
    
    ...
}
Nooooooo
glReadPixels seems to have a problem with large areas
Pages: 1 2 3 4 5