OpenGL + SDL

Sorry for the completely n00b question here :slight_smile:

I’ve just started doing some OpenGL and I’m making a little app where you
can fly about a scene.

Just wondering… I tried to draw a rectangle using SDL_FillRect() onto my
main surface and I don’t get anything.

Is it not possible to use some of these SDL functions? Am I doing it wrong?
How can I do it?

Basically all I’m trying to achieve is a little bar to show how fast I’m
moving, so I don’t have to look at the console stream to see my speed! :slight_smile:
hehehe :slight_smile:

Cheers,

Steve :slight_smile:

[…]

Just wondering… I tried to draw a rectangle using SDL_FillRect()
onto my main surface and I don’t get anything.

Is it not possible to use some of these SDL functions? Am I doing
it wrong? How can I do it?

This is becoming a VFAQ…

No, SDL 2D rendering does not mix with 3D acceleration. This is not
really an issue with SDL, but rather a direct result of the fact that
2D and 3D drivers and APIs just won’t cooperate nicely. If you’re
doing 3D, use the 3D API for everything. OpenGL is much more powerful
than any commonly available accelerated 2D API anyway, so you can
only win.

That said, I’ve implemented the SDL 2D API on top of OpenGL in the
form of the compile time wrapper glSDL;

http://olofson.net/mixed.html
  • but this isn’t really the right tool for the job if you’re writing a
    3D app. It will work if you deal with the fact that it assumes it’s
    the only OpenGL “client” in the app, but it’s not designed for it,
    and is very limited compared to native OpenGL rendering. glSDL is a
    way getting full h/w acceleration for pure SDL 2D applications, and
    the only future plans I have for it is to make it a proper SDL
    backend.

Basically all I’m trying to achieve is a little bar to show how
fast I’m moving, so I don’t have to look at the console stream to
see my speed! :slight_smile: hehehe :slight_smile:

Just render a quad with no texture (actually, the built-in white
texture) and suitable color modulation. The easiest way is to
probably change the display matrix to ortho, effectively mapping the
X and Y coordinates to 2D screen coordinates. Another way is to just
transform the desired coordinates into world cordinates for the
current view, but that could potentially have accuracy issues.

//David Olofson - Programmer, Composer, Open Source Advocate

.- The Return of Audiality! --------------------------------.
| Free/Open Source Audio Engine for use in Games or Studio. |
| RT and off-line synth. Scripting. Sample accurate timing. |
`-----------------------------------> http://audiality.org -’
http://olofson.nethttp://www.reologica.se —On Wednesday 12 March 2003 11.40, Sweeney, Steven (FNB) wrote: