Sam got a simple question for you!

Hi,

So well i was playing around the Nehe source code about OpenGL. And i wonder
if today we have to transform RGB images to BGR as OpenGL want ! Because i
try some Mesa examples that i transformed with SDL and by just loading BMP
or JPG images with SDL_image without transformed them and it works fine !

Lawouach

“sylvain.hellegouarch” <sylvain.hellegouarch at libertysurf.fr> wrote:

Hi,

So well i was playing around the Nehe source code about OpenGL. And i wonder
if today we have to transform RGB images to BGR as OpenGL want ! Because i
try some Mesa examples that i transformed with SDL and by just loading BMP
or JPG images with SDL_image without transformed them and it works fine !

Lawouach

I’m not Sam but I guess I can answer anyways :wink: Use GL_BGR when passing the
data to OpenGL.

                        Daniel Vogel, Programmer, Loki Software Inc.

Daniel Vogel a ?crit :

Use GL_BGR when passing the data to OpenGL.

Which function accept this constant? “SetVideoMode”?
Is it a new feature of SDL 1.1.6?

Marc

Hum I don’t think so, it may sounds like a OpenGL macro…

Moreover as i translated some examples from the Mesa source codes all
written with GLUT. But many examples starts with a glut function which
initialise many GL behaviours. SDL can’t do this as the
SDL_GL_SetAttribute() is poor in parameters compare to the GLUT ones.

I mean I’ve talked with lots of french coders and many of them who don’t
know SDL a lot wonders why use SDL instead of GLUT in OpenGL app. Because it
seems for them that GLUT is more powerful.

Lawouach

“Marc Lavall?e” a ?crit dans le message news:
3A1F43F5.CE002947 at videotron.ca…> Daniel Vogel a ?crit :

Use GL_BGR when passing the data to OpenGL.

Which function accept this constant? “SetVideoMode”?
Is it a new feature of SDL 1.1.6?

Marc

Marc Lavall?e wrote:

Daniel Vogel a ?crit :

Use GL_BGR when passing the data to OpenGL.

Which function accept this constant? “SetVideoMode”?
Is it a new feature of SDL 1.1.6?

Marc

Something like this (but probably not exactly):

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, image->w, image->h, 0,
GL_BGR, GL_UNSIGNED_BYTE, image->pixels);

“sylvain.hellegouarch” wrote:

Hum I don’t think so, it may sounds like a OpenGL macro…

Moreover as i translated some examples from the Mesa source codes all
written with GLUT. But many examples starts with a glut function which
initialise many GL behaviours. SDL can’t do this as the
SDL_GL_SetAttribute() is poor in parameters compare to the GLUT ones.

I mean I’ve talked with lots of french coders and many of them who don’t
know SDL a lot wonders why use SDL instead of GLUT in OpenGL app. Because it
seems for them that GLUT is more powerful.

Lawouach

Once you have created the video surface, you can use gl functions to
do whatever you want. SDL facilitates loading the right OpenGL
implementation, and, more importantly, provides access to mouse,
keyboard and joystick events.

-Ray

sylvain.hellegouarch <sylvain.hellegouarch at libertysurf.fr> schrieb am 25 Nov 2000:

I mean I’ve talked with lots of french coders and many of them who don’t
know SDL a lot wonders why use SDL instead of GLUT in OpenGL app. Because it
seems for them that GLUT is more powerful.

I have used both glut and SDL and I can name a lot of reasons to use SDL:

  • better fullscreen support (gameglut is not very portable)
  • you keep the main loop to yourself
  • glut can’t dlopen OpenGL (requirement on Voodoo1/2 systems)
  • LGPLd, you can ship modified versions with your product
  • SDL is under active development
  • glut is dead, and the license prohibits anyone from taking it up again
  • better mouse/keyboard support
  • goodies like sound, networking, threads
  • goodies like image loading functions / libraries

What’s missing in SDL

  • fonts, menus
  • platonic solids

glut’s font & menu capabilities are next to useless for games, so you
probably won’t miss them anyway

The platonic solids code can be ripped from freeglut (freeglut.sourceforge.net
I think). The teapot can be ripped from glut, since it’s SGI code
(x-licensed).

  • Andreas–
    Check out my 3D lightcycle game: http://www.gltron.org
    More than 90’000 Downloads of the latest version (0.59)

As far as I know passing GL_BGR wont work with glTexImage. there is
GL_BGR_EXT extension for that purpose but it is not supported on all
drivers (it is an extension after all). The best way is to check the pixel
format and swap the B-R values of the surface. If you are still intersted
I can post some code on how to do that.On Sat, 25 Nov 2000, Ray Kelm wrote:

Marc Lavall?e wrote:

Daniel Vogel a ?crit :

Use GL_BGR when passing the data to OpenGL.

Which function accept this constant? “SetVideoMode”?
Is it a new feature of SDL 1.1.6?

Marc

Something like this (but probably not exactly):

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, image->w, image->h, 0,
GL_BGR, GL_UNSIGNED_BYTE, image->pixels);