Blitting outside the screen area

How does SDL handle blitting outside the visible screen area? If I
animate object, do I have to check and change the drawing area if going
outside the screen or can I draw outside the screen coordinates and be
without any worry?

Hi Juhana,
I am fairly sure that SDL clips the everything, but I am sure more
knowledgable individuals on the list will correct me if I am wrong.

L8R,

Dominique.

Juhana Lehtiniemi wrote:> How does SDL handle blitting outside the visible screen area? If I

animate object, do I have to check and change the drawing area if going
outside the screen or can I draw outside the screen coordinates and be
without any worry?


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

Yeah, I’m pretty sure it does too. Some of my surfaces are partially blitted
outside the viewable area, and I was expecting a crash. Nothing of the sort
happened though, so I guess it’s safe to say there is clipping.> -----Original Message-----

From: Dominique Louis [SMTP:Dominique at SavageSoftware.com.au]
Sent: Thursday, January 31, 2002 12:25 PM
To: sdl at libsdl.org
Subject: Re: [SDL] blitting outside the screen area

Hi Juhana,
I am fairly sure that SDL clips the everything, but I am sure more
knowledgable individuals on the list will correct me if I am wrong.

L8R,

Dominique.

Juhana Lehtiniemi wrote:

How does SDL handle blitting outside the visible screen area? If I
animate object, do I have to check and change the drawing area if going
outside the screen or can I draw outside the screen coordinates and be
without any worry?


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


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

Yeah, I’m pretty sure it does too. Some of my surfaces are partially blitted
outside the viewable area, and I was expecting a crash. Nothing of the sort
happened though, so I guess it’s safe to say there is clipping.

The blits are clipped, but the update rectangles are not (SDL_UpdateRects())
This is a speed optimization, so be sure that you save the clipped rectangle
that SDL_BlitSurface() returns (dstrect)

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

As far as I know, SDL doesn’t clip by default, and I’ve already seen it seg-
faulting several times because of me blitting outside a surface. You’ll have
to use SDL_SetClipRect() to define the clipping area of your surface. You’ll
find more details about this function in the documentation.

Mahmoud>Yeah, I’m pretty sure it does too. Some of my surfaces are partially blitted

outside the viewable area, and I was expecting a crash. Nothing of the sort
happened though, so I guess it’s safe to say there is clipping.

-----Original Message-----
From: Dominique Louis [SMTP:Dominique at SavageSoftware.com.au]
Sent: Thursday, January 31, 2002 12:25 PM
To: sdl at libsdl.org
Subject: Re: [SDL] blitting outside the screen area

Hi Juhana,
I am fairly sure that SDL clips the everything, but I am sure more
knowledgable individuals on the list will correct me if I am wrong.

L8R,

Dominique.

Juhana Lehtiniemi wrote:

How does SDL handle blitting outside the visible screen area? If I
animate object, do I have to check and change the drawing area if going
outside the screen or can I draw outside the screen coordinates and be
without any worry?


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


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


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

—end quoted text—

Sometimes when I had a screen like this:
XXX
XXY
XXX
and write XY over the Y, I got:
XXX
XXX
YXX
since the screen is a matrix of pixels, if you pass outside one line, you’re on the start of the other…
But to get this you have to write your own blitting functions, ‘cose like Sam said, sdl’ blit clip the rectangles…

[]'sOn Thu, Jan 31, 2002 at 03:18:39PM -0000, Sweeney, Steven (FNB) wrote:

Yeah, I’m pretty sure it does too. Some of my surfaces are partially blitted
outside the viewable area, and I was expecting a crash. Nothing of the sort
happened though, so I guess it’s safe to say there is clipping.

Marcelo R Leitner <@Marcelo_Ricardo_Leit>
ICQ #: 29966851

Oh, so that’s why it changes the dstrect for you! I never realized that.
This is like some kind of epiphany or something. :)On Thu, Jan 31, 2002 at 07:49:23AM -0800, Sam Lantinga wrote:

Yeah, I’m pretty sure it does too. Some of my surfaces are partially blitted
outside the viewable area, and I was expecting a crash. Nothing of the sort
happened though, so I guess it’s safe to say there is clipping.

The blits are clipped, but the update rectangles are not (SDL_UpdateRects())
This is a speed optimization, so be sure that you save the clipped rectangle
that SDL_BlitSurface() returns (dstrect)

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


Greg V. (hmaon)

I copied some code from the sdl version of nehe’s
tutorial for loading textures. The problem is that the
texture’s colors come out different from what they
are. Anyway when I compiled the code in VC it didn’t
recognize GL_BGR in this line of code:

glTexImage2D( GL_TEXTURE_2D, 0, 3, TextureImage[0]->w,
TextureImage[0]->h, 0, GL_RGB,GL_UNSIGNED_BYTE,
TextureImage[0]->pixels );

As you can see, I changed GL_BGR to GL_RGB. Could this
be the problem? If so, how do I fix it since VC
wouldn’t recognize GL_BGR?

Thanks
Herbert=====
Game Programming Groups
VS Entertainment(Houston game dev group, looking for members)
IGP(Internet game programming group, looking for members also)
Ask me for details…


Do You Yahoo!?
Great stuff seeking new owners in Yahoo! Auctions!
http://auctions.yahoo.com

Hi,

Your code is compiled with VC ?? So what about using DevIL ??
http://openil.sourceforge.net/

IMHU, this is the best library to load graphic files.
In my current project, I use SDL Image but I’m not proud of the code to get
OpenGL textures so I won’t post it publicly :wink:

Bernard.
http://www.nitrocodecorps.com> ----- Original Message -----

From: red_dragon08@yahoo.com (Herbert Ayers)
To:
Sent: Thursday, January 31, 2002 7:40 PM
Subject: [SDL] opengl textures

I copied some code from the sdl version of nehe’s
tutorial for loading textures. The problem is that the
texture’s colors come out different from what they
are. Anyway when I compiled the code in VC it didn’t
recognize GL_BGR in this line of code:

glTexImage2D( GL_TEXTURE_2D, 0, 3, TextureImage[0]->w,
TextureImage[0]->h, 0, GL_RGB,GL_UNSIGNED_BYTE,
TextureImage[0]->pixels );

As you can see, I changed GL_BGR to GL_RGB. Could this
be the problem? If so, how do I fix it since VC
wouldn’t recognize GL_BGR?

Thanks
Herbert

=====
Game Programming Groups
VS Entertainment(Houston game dev group, looking for members)
IGP(Internet game programming group, looking for members also)
Ask me for details…


Do You Yahoo!?
Great stuff seeking new owners in Yahoo! Auctions!
http://auctions.yahoo.com


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

I’m not sure what you’re trying to do, so this may or may not be useful.
GL_BGR is defined for OpenGL 1.2 but not 1.1 (which is what the opengl.h
included with VC++ implements). The VC++ opengl.h does define GL_BGR_EXT,
however, which will do what you want. So you could do this some where in
your code:

#if defined(WIN32) && !defined(GL_BGR)

define GL_BGR GL_BGR_EXT

#endif

and you’re app should compile/run on any machine where opengl.h
implements 1.2 as well as with the VC++ opengl.h header.

Again, this may or may not not solve your problem in the long run; it all
depends on what you’re trying to do. A better solution may be to create a
new SDL surface with the format you’re looking for (e.g. RGB), blit the
texture onto the new surface, and then call glTexImage2D with the new
surface’s pixel data. I’ve done that before too – in fact I think
Mathais wrote an example of this. It all depends on what you
want to do.

DaveOn Thu, 31 Jan 2002, Red wrote:

I copied some code from the sdl version of nehe’s
tutorial for loading textures. The problem is that the
texture’s colors come out different from what they
are. Anyway when I compiled the code in VC it didn’t
recognize GL_BGR in this line of code:

glTexImage2D( GL_TEXTURE_2D, 0, 3, TextureImage[0]->w,
TextureImage[0]->h, 0, GL_RGB,GL_UNSIGNED_BYTE,
TextureImage[0]->pixels );

As you can see, I changed GL_BGR to GL_RGB. Could this
be the problem? If so, how do I fix it since VC
wouldn’t recognize GL_BGR?

Thanks
Herbert

=====
Game Programming Groups
VS Entertainment(Houston game dev group, looking for members)
IGP(Internet game programming group, looking for members also)
Ask me for details…


Do You Yahoo!?
Great stuff seeking new owners in Yahoo! Auctions!
http://auctions.yahoo.com


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


David MacCormack
@David_MacCormack

In the land of Redmond, where the Windows lie.
One OS to rule them all, One OS to find them,
One OS to bring them all and in the darkness bind them.
In the land of Redmond, where the Windows lie.

included with VC++ implements). The VC++ opengl.h

I mean gl.h. Man do I need (another) vacation.

DaveOn Thu, 31 Jan 2002, David MacCormack wrote:


David MacCormack
@David_MacCormack

In the land of Redmond, where the Windows lie.
One OS to rule them all, One OS to find them,
One OS to bring them all and in the darkness bind them.
In the land of Redmond, where the Windows lie.

This worked fine. Thanks

Herbert
— David MacCormack wrote:>

I’m not sure what you’re trying to do, so this may
or may not be useful.
GL_BGR is defined for OpenGL 1.2 but not 1.1 (which
is what the opengl.h
included with VC++ implements). The VC++ opengl.h
does define GL_BGR_EXT,
however, which will do what you want. So you could
do this some where in
your code:

#if defined(WIN32) && !defined(GL_BGR)

define GL_BGR GL_BGR_EXT

#endif

and you’re app should compile/run on any machine
where opengl.h
implements 1.2 as well as with the VC++ opengl.h
header.

Again, this may or may not not solve your problem in
the long run; it all
depends on what you’re trying to do. A better
solution may be to create a
new SDL surface with the format you’re looking for
(e.g. RGB), blit the
texture onto the new surface, and then call
glTexImage2D with the new
surface’s pixel data. I’ve done that before too –
in fact I think
Mathais wrote an example of this. It all depends on
what you
want to do.

Dave

On Thu, 31 Jan 2002, Red wrote:

I copied some code from the sdl version of nehe’s
tutorial for loading textures. The problem is that
the
texture’s colors come out different from what they
are. Anyway when I compiled the code in VC it
didn’t
recognize GL_BGR in this line of code:

glTexImage2D( GL_TEXTURE_2D, 0, 3,
TextureImage[0]->w,
TextureImage[0]->h, 0, GL_RGB,GL_UNSIGNED_BYTE,
TextureImage[0]->pixels );

As you can see, I changed GL_BGR to GL_RGB. Could
this
be the problem? If so, how do I fix it since VC
wouldn’t recognize GL_BGR?

Thanks
Herbert

=====
Game Programming Groups
VS Entertainment(Houston game dev group, looking
for members)
IGP(Internet game programming group, looking for
members also)
Ask me for details…


Do You Yahoo!?
Great stuff seeking new owners in Yahoo! Auctions!
http://auctions.yahoo.com


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


David MacCormack
djm at maccormack.net

In the land of Redmond, where the Windows lie.
One OS to rule them all, One OS to find them,
One OS to bring them all and in the darkness bind
them.
In the land of Redmond, where the Windows lie.


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

=====
Game Programming Groups
VS Entertainment(Houston game dev group, looking for members)
IGP(Internet game programming group, looking for members also)
Ask me for details…


Do You Yahoo!?
Great stuff seeking new owners in Yahoo! Auctions!
http://auctions.yahoo.com

I am not certain where offhand you may find an OpenGL 1.2 header. I am
certain, however, that Quake3 requires OpenGL 1.2 and if your drivers work
with it then you really should try to track one down. It’s really a lot
better for you in the long run.

As many here have already heard my rants about OpenGL SDK stupidity on the
various platforms would likely have my hide if I repeated it again, let me
simply summarize my conclusion: Don’t trust the system’s idea of what you
use for OpenGL development. I have my own OpenGL header and I load my lib
at runtime, using SDL_GL_LoadLibrary. It’s quite effective. =)On Thu, Jan 31, 2002 at 10:11:31PM -0800, Red wrote:

This worked fine. Thanks


Joseph Carter I swallowed your goldfish

<Kysh_> Joey: I’m on it right now… 3 1.3Gb disks, 128M ram, dual 50Mhz
(Up to quad 250Mhz)
<Kysh_> The catch is that it pulls 110v at about 12A 8>
12A!
Okay, my stove is 3000W, this sun is 1320W
DO YOU SEE A PROBLEM HERE
a 1320W sun, that is like a hair dryer :slight_smile:

-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/pgp-signature
Size: 273 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20020131/86d2c871/attachment.pgp