Login
Username:

Password:

Remember me



Lost Password?

Register now!
Sections
Who's Online
84 user(s) are online (65 user(s) are browsing Forums)

Members: 1
Guests: 83

Steady, more...
Support us!
Recent OS4 Files
OS4Depot.net
Report message:*
 

Re: SDL1 open issues

Subject: Re: SDL1 open issues
by kas1e on 2019/8/25 6:11:32

@Capehill

I just added:

printf("surface->getRedMask() = %08x, surface->getGreenMask() = %08x, surface->getBlueMask() = %08x, surface->getAlphaMask() = %08xn",surface->getRedMask(), surface->getGreenMask(), surface->getBlueMask(), surface->getAlphaMask());


Rigth at begining of our block, and that what i have when i run example and it renders to half of screen with a wrong colors:

surface->getRedMask() = 00007c00
surface
->getGreenMask() = 000003e0
surface
->getBlueMask() = 0000001f
surface
->getAlphaMask() = 00008000


Now, I see in the SDL1 code:
https://sourceforge.net/p/irrlicht/cod ... rrlicht/CIrrDeviceSDL.cpp

In that CIrrDeviceSDL::present , that at begining they do that:

sdlSurface->format->BitsPerPixel=surface->getBitsPerPixel();
    
sdlSurface->format->BytesPerPixel=surface->getBytesPerPixel();
    if ((
surface->getColorFormat()==video::ECF_R8G8B8) ||
            (
surface->getColorFormat()==video::ECF_A8R8G8B8))
    {
        
sdlSurface->format->Rloss=0;
        
sdlSurface->format->Gloss=0;
        
sdlSurface->format->Bloss=0;
        
sdlSurface->format->Rshift=16;
        
sdlSurface->format->Gshift=8;
        
sdlSurface->format->Bshift=0;
        if (
surface->getColorFormat()==video::ECF_R8G8B8)
        {
            
sdlSurface->format->Aloss=8;
            
sdlSurface->format->Ashift=32;
        }
        else
        {
            
sdlSurface->format->Aloss=0;
            
sdlSurface->format->Ashift=24;
        }
    }
    else if (
surface->getColorFormat()==video::ECF_R5G6B5)
    {
        
sdlSurface->format->Rloss=3;
        
sdlSurface->format->Gloss=2;
        
sdlSurface->format->Bloss=3;
        
sdlSurface->format->Aloss=8;
        
sdlSurface->format->Rshift=11;
        
sdlSurface->format->Gshift=5;
        
sdlSurface->format->Bshift=0;
        
sdlSurface->format->Ashift=16;
    }
    else if (
surface->getColorFormat()==video::ECF_A1R5G5B5)
    {
        
sdlSurface->format->Rloss=3;
        
sdlSurface->format->Gloss=3;
        
sdlSurface->format->Bloss=3;
        
sdlSurface->format->Aloss=7;
        
sdlSurface->format->Rshift=10;
        
sdlSurface->format->Gshift=5;
        
sdlSurface->format->Bshift=0;
        
sdlSurface->format->Ashift=15;
    }


So they do check what video formats textures have, and set sdlSurface's format to necessary value because of this. Question is what and to which we need to set, if we don't use sdlSurface. I.e. can we call SDL_UpdateTexture()+SDL_RenderCopy() with necessary format taken from the above check ?

I just removed from the above checks all sdlSurfaces sets, and just put prinfs, so in our case (i.e. with your code and when it draws half of screen with wrong colors), its video::ECF_A1R5G5B5 format. That explain probably "half of screen" drawing and wrong colors as well. Need somehow to tell to SDL_UpdateTexture()+SDL_RenderCopy() what format we use.

Powered by XOOPS 2.0 © 2001-2016 The XOOPS Project