Problem: Segmentation Fault - SDL Parachute

Hi…

I trying to use a background SDL surface with a OpenGL object in fore.. see:---

.
.
.

if ((screen=SDL_SetVideoMode(width, height, bpp, flags)) == NULL)
{
	fprintf(stderr, "[SDL] Modo de video inaceitavel: %s\n", SDL_GetError());
	exit(EXIT_FAILURE);
}

.
.
.

if ((Texture = SDL_LoadBMP("my.bmp")) == NULL)
{
	fprintf(stderr, "[SDL] Loading bmp: %s\n", SDL_GetError());
	exit(EXIT_FAILURE);
}

if (SDL_BlitSurface(Texture, NULL, screen, NULL) < 0)
{
	fprintf(stderr, "[SDL] Blit Surface: %s\n", SDL_GetError());
	exit(EXIT_FAILURE);
}

SDL_UpdateRect(screen, 0, 0, Texture->w, Texture->h);      <<-- when code is 

here, then the segmentation fault occur… why?

SDL_FreeSurface(Texture);

.
.
.

I'm using linux.. sdl 1.2.2

thanks


;-----------------------------------------------------------------
;NoiS eH MaD - http://www.scientia.cjb.net
;
;A happy linux user #129517
;A linux machine #56653
;
;Assembly is Heaven! DemoScene is my world.
;------------------------------------------------------------------

This is really strange. For what I see, the code is okay (unlees I’m so
tired to see the error :wink: ).

Anyway, first try if you have the same problem changing the SDL_UpdateRect
for SDL_Flip(screen) or SDL_UpdateRect(screen, 0, 0, 0, 0). In that way,
we know if the problem is with SDL_UpdateRect (it shouldn’t be) or maybe
with the BMP?

Greettings.
Ernesto.On Fri, 14 Sep 2001, Danny Angelo Carminati Grein wrote:

Hi…

I trying to use a background SDL surface with a OpenGL object in fore… see:


.
.
.

if ((screen=SDL_SetVideoMode(width, height, bpp, flags)) == NULL)
{
fprintf(stderr, “[SDL] Modo de video inaceitavel: %s\n”, SDL_GetError());
exit(EXIT_FAILURE);
}

.
.
.

if ((Texture = SDL_LoadBMP(“my.bmp”)) == NULL)
{
fprintf(stderr, “[SDL] Loading bmp: %s\n”, SDL_GetError());
exit(EXIT_FAILURE);
}

if (SDL_BlitSurface(Texture, NULL, screen, NULL) < 0)
{
fprintf(stderr, “[SDL] Blit Surface: %s\n”, SDL_GetError());
exit(EXIT_FAILURE);
}

SDL_UpdateRect(screen, 0, 0, Texture->w, Texture->h); <<-- when code is
here, then the segmentation fault occur… why?

SDL_FreeSurface(Texture);

.
.
.

I’m using linux… sdl 1.2.2

thanks


;-----------------------------------------------------------------
;NoiS eH MaD - http://www.scientia.cjb.net
;
;A happy linux user #129517
;A linux machine #56653
;
;Assembly is Heaven! DemoScene is my world.
;------------------------------------------------------------------


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

may be SDL_BlitSurface(Texture, NULL, screen, NULL)

from docs:
If either srcrect OR dstrect are NULL, the entire surface (src or dst) is
copied.

otherwise, make a minimal prog to see if seg fault occurs

Murlock----------------
Gloire ? mon saigneur Arioch
Murlock (http://www.murlock.org)

----- Original Message -----
From: danny.cabelo@gmx.net (Danny Angelo Carminati Grein)
To:
Sent: Saturday, September 15, 2001 12:44 AM
Subject: [SDL] Problem: Segmentation Fault - SDL Parachute

Hi…

I trying to use a background SDL surface with a OpenGL object in fore…
see:


.
.
.

if ((screen=SDL_SetVideoMode(width, height, bpp, flags)) == NULL)
{
fprintf(stderr, “[SDL] Modo de video inaceitavel: %s\n”, SDL_GetError());
exit(EXIT_FAILURE);
}

.
.
.

if ((Texture = SDL_LoadBMP(“my.bmp”)) == NULL)
{
fprintf(stderr, “[SDL] Loading bmp: %s\n”, SDL_GetError());
exit(EXIT_FAILURE);
}

if (SDL_BlitSurface(Texture, NULL, screen, NULL) < 0)
{
fprintf(stderr, “[SDL] Blit Surface: %s\n”, SDL_GetError());
exit(EXIT_FAILURE);
}

SDL_UpdateRect(screen, 0, 0, Texture->w, Texture->h); <<-- when code
is
here, then the segmentation fault occur… why?

SDL_FreeSurface(Texture);

.
.
.

I’m using linux… sdl 1.2.2

thanks


;-----------------------------------------------------------------
;NoiS eH MaD - http://www.scientia.cjb.net
;
;A happy linux user #129517
;A linux machine #56653
;
;Assembly is Heaven! DemoScene is my world.
;------------------------------------------------------------------


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

“Murlock” wrote:

from docs:
If either srcrect OR dstrect are NULL, the entire surface (src or dst) is
copied.

that part of the docs is misleading — only the srcrect specifies the size
of the copied rectangle; the dstrect width/height is ignored (but set to
the actual copied rectangle)

I’ll clarify the docs on this

I trying to use a background SDL surface with a OpenGL object in fore… see:

If your flags include SDL_OPENGL, then you can’t blit to or from the video
surface. There is a hack flag, SDL_OPENGLBLIT, but I don’t recommend it
unless there really is no other way to do what you want to do.

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment

@sam latinga

hi, just two questions:

#1: why do you send answers on questions I never asked you?

you write mails to me as if I’d be someone else!

(since I’ve put my name on the official mailing list, I get a lot of mails with people replying on topics, I never talked about)

Well, that’s what a mailing list is for. A group of people who discuss
about various topics - if you subscribed to the list, you receive your
mails, but also others peoples’ ones. Because you are supposed to give
them your help too, when you can solve their problems. For a general
information about mailing lists and the way to behave on them, see
http://www.tuxedo.org/~esr/faqs/smart-questions.html. In particular, do
not ask Sam for specific things here - there are a lot of people
participating to this list, who can help you for your SDL related
problems. Sam is a very busy person, and I don’t think he has time for
doing SDL support all the time.

#2: wheres the cursor?

I wrote a tiny program with only 70 lines of code.
But I realy wonder why the cursor is invisible (although I added SDL_ShowCursor(SDL_ENABLE) ?

Please take a look at it, a approached it to this mail

… and where is the SDL_ShowCursor(SDL_ENABLE) in the source code you
sent?

Alex.

#1: why do you send answers on questions I never asked you?

you write mails to me as if I’d be someone else!

That’s probably because they’re answering someone else =)

You know, that’s what mailinglists are all about. You send a message
to the list, and all the people subscribed get it. Some of them might
got a comment or answer, etc.–
Trick


Linux User #229006 * http://counter.li.org

[Segunda 17 Setembro 2001 12:58]:

I trying to use a background SDL surface with a OpenGL object in fore..

see:

If your flags include SDL_OPENGL, then you can’t blit to or from the video
surface. There is a hack flag, SDL_OPENGLBLIT, but I don’t recommend it

hmm.. why? what is the problem to use this?

unless there really is no other way to do what you want to do.

I have another way to do this.. (A big opengl poly fullscreen.. :)  )
any idea how to do this ?  

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment

	Thanks...-- 

;-----------------------------------------------------------------
;NoiS eH MaD - http://www.scientia.cjb.net
;
;A happy linux user #129517
;A linux machine #56653
;
;Assembly is Heaven! DemoScene is my world.
;------------------------------------------------------------------