3d support in sdl

There will be 3d support (opengl) in sdl, like Direct3d?–
Roger D. Vargas | "Humans have so many emotions, Artoo. And most
VQt Development Team | seem to cause them pain. I do not understand,
http://vqt.sourceforge.net | but I’m glad I have none. And yet – I can’t help
wondering sometimes… what it would be like."
C-3PO, Protocol Droid. Star Wars 2: World of Fire.

http://sdldoc.csn.ul.ie/guidevideoopengl.phpOn Thu, Apr 26, 2001 at 08:34:53AM -0400, Roger D. Vargas wrote:

There will be 3d support (opengl) in sdl, like Direct3d?


Roger D. Vargas | "Humans have so many emotions, Artoo. And most
VQt Development Team | seem to cause them pain. I do not understand,
http://vqt.sourceforge.net | but I’m glad I have none. And yet – I can’t help
wondering sometimes… what it would be like."
C-3PO, Protocol Droid. Star Wars 2: World of Fire.


Martin

Bother! said Pooh, sending in a team from the S.A.S.

There will be 3d support (opengl) in sdl, like Direct3d?

SDL supports OpenGL already:

http://www.libsdl.org/faq/FAQ-General.html#GENERAL_3D
http://www.libsdl.org/opengl/intro.html

– Timo Suoranta – @Timo_K_Suoranta

There will be 3d support (opengl) in sdl, like Direct3d?

SDL supports OpenGL already:
I mean, its own opengl functions, not to load an external library.On Thu, 26 Apr 2001, Timo K Suoranta wrote:


Roger D. Vargas

  • You don’t know the power of the Win Side *
    Darth Gates

I mean, its own opengl functions, not to load an external library.

Why reimplement OpenGL? What would be the difference?

If you’re looking for an other (software) OpenGL implementation you can take
a look at Mesa3D.> -----Original Message-----

From: Roger D. Vargas [mailto:mad at pesca.esisc.colombus.cu]

Why reimplement OpenGL? What would be the difference?

Maybe he is looking for scene graph library, which OpenGL
is not - and that doesn’t sound ‘simple’ or ‘direct’ media
to me.

If you’re looking for an other (software) OpenGL implementation you can take
a look at Mesa3D.

Or, if you are looking for something compact, try TinyGL.

– Timo Suoranta – @Timo_K_Suoranta

I mean, its own opengl functions, not to load an external library.

Why reimplement OpenGL? What would be the difference?

If you’re looking for an other (software) OpenGL implementation you can take
a look at Mesa3D.
Yes, but, is Mesa ported to Windos? I’m thinking in a portable gl lib
integrated with SDL, like sound.On Fri, 27 Apr 2001, Dominique Biesmans wrote:

-----Original Message-----
From: Roger D. Vargas [mailto:mad at pesca.esisc.colombus.cu]

Roger D. Vargas

  • You don’t know the power of the Win Side *
    Darth Gates

I mean, its own opengl functions, not to load an external library.

Why reimplement OpenGL? What would be the difference?

If you’re looking for an other (software) OpenGL implementation you can
take a look at Mesa3D.

Yes, but, is Mesa ported to Windos? I’m thinking in a portable gl lib
integrated with SDL, like sound.

Why, and what would you use it for?

Most serious 3D rendering requires either speed that can only be delivered by
dedicated hardware, or rendering quality that’s only possible to get from a
very sophisticated OpenGL implementation. Some applications even require both
at the same time…

All but the software-only solutions are inherently non-portable, of course,
as they rely on specific rendering hardware and low level OS features. On
some platforms, it even has to run in kernel spaces, or a similar
non-application environment.

If you’re thinking about some kind of software “MiniGL” for games, that’s
also a rather non-trivial beast, which has to be very carefully optimized to
be of any use at all. Besides, OpenGL isn’t really the right API for that, it
seems, as many games, and even more applications have problems even with
"real" OpenGL drivers, just because some features aren’t properly
implemented. Meanwhile, it seems like a full software implementation of
OpenGL 1.2 is inherently very, very slow on current CPUs…

//David

.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
----------------------> http://www.linuxaudiodev.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |--------------------------------------> david at linuxdj.com -'On Monday 30 April 2001 17:58, Roger D. Vargas wrote:

On Fri, 27 Apr 2001, Dominique Biesmans wrote:

-----Original Message-----
From: Roger D. Vargas [mailto:mad at pesca.esisc.colombus.cu]

I mean, its own opengl functions, not to load an external library.

Why reimplement OpenGL? What would be the difference?

If you’re looking for an other (software) OpenGL implementation you can
take a look at Mesa3D.

Yes, but, is Mesa ported to Windos? I’m thinking in a portable gl lib
integrated with SDL, like sound.

Why, and what would you use it for?

Most serious 3D rendering requires either speed that can only be delivered
by
dedicated hardware, or rendering quality that’s only possible to get from
a
very sophisticated OpenGL implementation. Some applications even require
both
at the same time…

All but the software-only solutions are inherently non-portable, of
course,
as they rely on specific rendering hardware and low level OS features. On
some platforms, it even has to run in kernel spaces, or a similar
non-application environment.

If you’re thinking about some kind of software “MiniGL” for games, that’s
also a rather non-trivial beast, which has to be very carefully optimized
to
be of any use at all. Besides, OpenGL isn’t really the right API for that,
it
seems, as many games, and even more applications have problems even with
"real" OpenGL drivers, just because some features aren’t properly
implemented. Meanwhile, it seems like a full software implementation of
OpenGL 1.2 is inherently very, very slow on current CPUs…

Not only is Mesa ported to Windows, but SDL also supports the normal OpenGL
from Windows. This should be hardware-accelerated if the card supports DX8,
and therefore is exactly what you need. How do you think should e.g.
TuxRacer run if it were not? Oh, and for the Mesa ports, see
http://www.mesa3d.org/ .

HTH

----- Original Message -----
From: david.olofson@reologica.se (David Olofson)
To:
Sent: Monday, April 30, 2001 7:45 PM
Subject: Re: [SDL] 3d support in sdl
On Monday 30 April 2001 17:58, Roger D. Vargas wrote:

On Fri, 27 Apr 2001, Dominique Biesmans wrote:

-----Original Message-----
From: Roger D. Vargas [mailto:mad at pesca.esisc.colombus.cu]

If you’re looking for an other (software) OpenGL implementation you
can take

a look at Mesa3D.
Yes, but, is Mesa ported to Windos? I’m thinking in a portable gl
lib
integrated with SDL, like sound.

Mesa has OsMesa, an off-screen rendering mechanism. I’m writing a
little wrapper that allows you to use an SDL surface with it.
(actually, any number of SDL surfaces)

It would be the most portable way of doing it, except it seems OsMesa
only works with 32-bit pixels.–

Olivier A. Dagenais - Software Architect and Developer

Hi,

I have a valid bitmap that seems to crash LoadBMP when i put it into the
example Opengl code (Lesson06). Are there any known problems with bitmap
loading? What’s interesting is if I open up the example’s bitmap and copy
my bitmap over it seems to work.

If you want I can send you the bitmap
Thanks--------------
-Larry

I have a valid bitmap that seems to crash LoadBMP when i put it into the
example Opengl code (Lesson06).
If you want I can send you the bitmap

yes, please do so (or even better, send an URL)

//sdl at lokigames.com wrote:

I have a valid bitmap that seems to crash LoadBMP when i put it into the
example Opengl code (Lesson06).
If you want I can send you the bitmap

yes, please do so (or even better, send an URL)

I had the same problem a few days ago. The reason was the dimension of the image. It would not load unless it was a power of 2. (ie: 2x2, 4x4, 256x256 etc); but I think that was an opengl thing not loadBMP.__________________________________________________________________
Get your own FREE, personal Netscape Webmail account today at http://webmail.netscape.com/

This is common problem. Stuff like Photoshop and MSPaint have slight
variances in the way they save the BMP’s. Try opening it up in MSPaint,
adding a pixel somewhere unnoticeable, and resaving it. If it works, then
that bmp’s original paint program didnt quite do its job.

Trust nothing :slight_smile:

Matt> Hi,

I have a valid bitmap that seems to crash LoadBMP when i put it into the
example Opengl code (Lesson06). Are there any known problems with bitmap
loading? What’s interesting is if I open up the example’s bitmap and copy
my bitmap over it seems to work.

If you want I can send you the bitmap
Thanks

-Larry

I had the same problem a few days ago. The reason was the dimension of the image. It would not load unless it was a power of 2. (ie: 2x2, 4x4, 256x256 etc); but I think that was an opengl thing not loadBMP.

The code is also designed to load 24-bit BMP files only.
If you load 8-bit BMPs it will crash.

See ya,
-Sam Lantinga, Lead Programmer, Loki Entertainment Software

Not only is Mesa ported to Windows, but SDL also supports the normal OpenGL
from Windows. This should be hardware-accelerated if the card supports DX8,
and therefore is exactly what you need. How do you think should e.g.
TuxRacer run if it were not? Oh, and for the Mesa ports, see
http://www.mesa3d.org/ .

Just for reference:
Mesa does run under windows, it is extremely slow if you are just using
software rendering.
I was getting less than 1fps in Mesa, 10-15fps in SDL 2D surfaces and 127fps
on my Rage 128(32MB) card in Windows. I used 3 512x512 32bit png’s, and 5
surfaces that are less than 512x512. (I was using OpenGL for the
alphablending mainly. Basically 8 textured polygons.) I keep getting people
going “Why are you using OpenGL when the game isn’t 3D?” I can’t convince
them that you can do regular 2D work in OpenGL. This is the only way I can
get large alpha blended surfaces at a decent frame rate. Doesn’t anyone know
of any 2D api that has hardware accelerated alpha-blitting?

The trick I think with MESA is not to use it as a software-renderer if you
can help it. I have a Pentium II 450 and couldn’t get Software Mode MESA to
put out more than 1 frame per second.

MESA does use the system OpenGL if you compile it to do so under windows, so
you can still get the hardware acceleration through MESA aparently._________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

//sdl at lokigames.com wrote:

I have a valid bitmap that seems to crash LoadBMP when i put it into the
example Opengl code (Lesson06).
If you want I can send you the bitmap

yes, please do so (or even better, send an URL)

I had the same problem a few days ago. The reason was the dimension of
the image. It
would not load unless it was a power of 2. (ie: 2x2, 4x4, 256x256 etc); but
I think that was
an opengl thing not loadBMP.

OpenGL requires textures to be powers of two in both dimensions, but they
don’t need to be squares. 2x2,2x4,2x8,4x8,32x32,32x128,etc

According to Microsofts sparse OpenGL sdk, 256x256 textures are the most
efficient.

What I did in my code was to check if the image was a power of 2 in both
dimensions and if it wasn’t, to software-blit it onto a alpha surface that
was. so a 120x60 would be put on a 128x64 surface. Then that surface was
given to OpenGL.

Also…

Make sure you use the correct settings, the internal format, image format
and data type need to be correct or you get bad-colors or crashes.

This is what I used:

if(surfacename->format->BitsPerPixel==32){iformat=GL_RGBA8;format=GL_RGBA;ty
pe=GL_UNSIGNED_BYTE;SDL_SetAlpha(surfacename,0,0);}

if(surfacename->format->BitsPerPixel==24){iformat=GL_RGB8;format=GL_RGB;type
=GL_UNSIGNED_BYTE;}

if(surfacename->format->BitsPerPixel==16){iformat=GL_RGB5;format=GL_RGB;type
=GL_UNSIGNED_BYTE;}

glTexImage2D(GL_TEXTURE_2D, 0, iformat, surfacename->w, surfacename->h, 0,
format, type, surfacename->pixels);

Mind you, I also never tried loading 16-bit images with this code, only 32
and 24bit.

Internally, OpenGL is supposed to convert everything to 32bit IIRC._________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

If you’re looking for an other (software) OpenGL implementation you

can take

a look at Mesa3D.

Yes, but, is Mesa ported to Windos? I’m thinking in a portable gl

lib

integrated with SDL, like sound.

Mesa has OsMesa, an off-screen rendering mechanism. I’m writing a
little wrapper that allows you to use an SDL surface with it.
(actually, any number of SDL surfaces)

That makes a lot more sense than writing up an new OpenGL implementation (or
something) for SDL, IMHO.

It would be the most portable way of doing it, except it seems OsMesa
only works with 32-bit pixels.

Sounds reasonable, considering the additional overhead and complexity
involved in blending using pixel formats other than 8:8:8 bit… (As to 24
bit; that’s not a very nice format WRT indexing and alignment, obviously.)

If speed isn’t a concern, you could try wrapping the SDL surface format
conversion up in some nice way. (That is, always render to a 32 bit surface,
then convert if the target is in some other format. Gets a little more
complicated if you’re going to render models on top of graphics rendered
other ways, but it should be possible to do that as well, in a similar way.)

//David

.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
----------------------> http://www.linuxaudiodev.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |--------------------------------------> david at linuxdj.com -'On Tuesday 01 May 2001 00:24, Olivier Dagenais wrote: