SDL_BlitSurface doesn't work in SDL 2.0?

I’m still new to SDL2.0 and I dont really understand how everything works.
I’ve created surface by FillRect, transform it into Texture and Render it.
But when I try that surface blit into another surface and then
transform Texture & Render… nothing
Code example http://pastebin.com/bi2JpcbC
What the hell Am I doing wrong?

As a quick check, try setting amask to 0 before SDL_CreateRGBSurface().
You might be blitting onto a transparent surface and getting a transparent
result.

Jonny DOn Mon, Dec 24, 2012 at 3:07 PM, Zaraka wrote:

I’m still new to SDL2.0 and I dont really understand how everything works.
I’ve created surface by FillRect, transform it into Texture and Render it.
But when I try that surface blit into another surface and then
transform Texture & Render… nothing
Code example http://pastebin.com/bi2JpcbC
What the hell Am I doing wrong?


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Yeah! It works… but I don’t understand why. Can you please explain me(for
dummies) why that amask have to be ‘0’? The source surface I created with
FillRect has amask to FF.

2012/12/24 Jonathan Dearborn > As a quick check, try setting amask to 0 before SDL_CreateRGBSurface().

You might be blitting onto a transparent surface and getting a transparent
result.

Jonny D

On Mon, Dec 24, 2012 at 3:07 PM, Zaraka wrote:

I’m still new to SDL2.0 and I dont really understand how everything works.
I’ve created surface by FillRect, transform it into Texture and Render it.
But when I try that surface blit into another surface and then
transform Texture & Render… nothing
Code example http://pastebin.com/bi2JpcbC
What the hell Am I doing wrong?


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

It shouldn’t be 0. That was just to see if you were getting a transparent
result and it wasn’t some other problem.

The Amask only tells SDL what format to expect when it reads the pixels
during a blit operation. So if it is 0, SDL thinks that there is no alpha
data, so it won’t do alpha-blending. The better way to turn it off
temporarily is with SDL_SetAlpha() and SDL_SRCALPHA. You can read some
explanation of it (in SDL 1.2) here:
http://code.bluedinosaurs.com/articles/blending.html

Jonny DOn Mon, Dec 24, 2012 at 3:40 PM, Zaraka wrote:

Yeah! It works… but I don’t understand why. Can you please explain
me(for dummies) why that amask have to be ‘0’? The source surface I created
with FillRect has amask to FF.

2012/12/24 Jonathan Dearborn <@Jonathan_Dearborn>

As a quick check, try setting amask to 0 before SDL_CreateRGBSurface().
You might be blitting onto a transparent surface and getting a transparent
result.

Jonny D

On Mon, Dec 24, 2012 at 3:07 PM, Zaraka wrote:

I’m still new to SDL2.0 and I dont really understand how everything
works.
I’ve created surface by FillRect, transform it into Texture and Render
it.
But when I try that surface blit into another surface and then
transform Texture & Render… nothing
Code example http://pastebin.com/bi2JpcbC
What the hell Am I doing wrong?


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

I read some articles about it and I understand what I did wrong. Thanks for
helping me :slight_smile:

2012/12/24 Jonathan Dearborn > It shouldn’t be 0. That was just to see if you were getting a transparent

result and it wasn’t some other problem.

The Amask only tells SDL what format to expect when it reads the pixels
during a blit operation. So if it is 0, SDL thinks that there is no alpha
data, so it won’t do alpha-blending. The better way to turn it off
temporarily is with SDL_SetAlpha() and SDL_SRCALPHA. You can read some
explanation of it (in SDL 1.2) here:
http://code.bluedinosaurs.com/articles/blending.html

Jonny D

On Mon, Dec 24, 2012 at 3:40 PM, Zaraka <@Zaraka> wrote:

Yeah! It works… but I don’t understand why. Can you please explain
me(for dummies) why that amask have to be ‘0’? The source surface I created
with FillRect has amask to FF.

2012/12/24 Jonathan Dearborn

As a quick check, try setting amask to 0 before SDL_CreateRGBSurface().
You might be blitting onto a transparent surface and getting a transparent
result.

Jonny D

On Mon, Dec 24, 2012 at 3:07 PM, Zaraka wrote:

I’m still new to SDL2.0 and I dont really understand how everything
works.
I’ve created surface by FillRect, transform it into Texture and Render
it.
But when I try that surface blit into another surface and then
transform Texture & Render… nothing
Code example http://pastebin.com/bi2JpcbC
What the hell Am I doing wrong?


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

You’re welcome. Sorry I didn’t have time to explain it all here (you can
probably imagine why ;). Good luck on the rest of your project!

Jonny DOn Tue, Dec 25, 2012 at 12:11 PM, Zaraka wrote:

I read some articles about it and I understand what I did wrong. Thanks
for helping me :slight_smile:

2012/12/24 Jonathan Dearborn <@Jonathan_Dearborn>

It shouldn’t be 0. That was just to see if you were getting a
transparent result and it wasn’t some other problem.

The Amask only tells SDL what format to expect when it reads the pixels
during a blit operation. So if it is 0, SDL thinks that there is no alpha
data, so it won’t do alpha-blending. The better way to turn it off
temporarily is with SDL_SetAlpha() and SDL_SRCALPHA. You can read some
explanation of it (in SDL 1.2) here:
http://code.bluedinosaurs.com/articles/blending.html

Jonny D

On Mon, Dec 24, 2012 at 3:40 PM, Zaraka wrote:

Yeah! It works… but I don’t understand why. Can you please explain
me(for dummies) why that amask have to be ‘0’? The source surface I created
with FillRect has amask to FF.

2012/12/24 Jonathan Dearborn <@Jonathan_Dearborn>

As a quick check, try setting amask to 0 before SDL_CreateRGBSurface().
You might be blitting onto a transparent surface and getting a transparent
result.

Jonny D

On Mon, Dec 24, 2012 at 3:07 PM, Zaraka wrote:

I’m still new to SDL2.0 and I dont really understand how everything
works.
I’ve created surface by FillRect, transform it into Texture and Render
it.
But when I try that surface blit into another surface and then
transform Texture & Render… nothing
Code example http://pastebin.com/bi2JpcbC
What the hell Am I doing wrong?


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org