Bitmap fonts with SDL / OpenGL |
Guilherme De Sousa
Guest
|
Hi,
I'm planning to use SDL with OpenGL but one thing I'm a bit unclear about is the best way to overlay my OpenGL view with bitmap images and bitmap fonts. I've been using my own bitmap fonts with SDL and overlaying images using colorKeys. Is there a fairly simple way to be able to do a similar thing when using SDL with OpenGL? I'd like to have a 3D openGL view and then overlay some text and bitmap images over the 3D view. I'm using Dev C++ with Windows XP. Thanks, Guilherme ___________________________________________________________ To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. http://uk.security.yahoo.com |
|||||||||||
|
Bitmap fonts with SDL / OpenGL |
JonasScholz at web.de
Guest
|
Hi,
as far as i know SDL_UpdateRect(screen, 0, 0, 0, 0) does not work when using OpenGL. It simples crash. As a solution you can load your bitmaps into a texture and display it by using glOrtho. Just render your 3D view, then switch to the ortho-modus and render your font. Nehe has a tutorial for it, just take a look. Jonas
|
|||||||||||||
|
Bitmap fonts with SDL / OpenGL |
Tommi Kyntola
Guest
|
Hi,
Fonts in 3D should indeed be rendered using textures alone (e.g. Ogre3D font stuff), but for the record, it is possible to use the SDL_Flip et al after using the SDL_OPENGLBLIT flag during video mode speicification. src/video/SDL_video.c:1500ish and SDL_GL_UpdateRects does just that. However, that merely creates textures from the ordinary SDL surfaces and displays them in 3D during the SDL_Flip/SDL_Update. This naturally has a serious impact on perfomance as you're forced to flip each frame and SDL_GL_UpdateRects is forced to recreate the textures regardless of wether the textures actually have changed or not. And for rendering fonts on screen this is definitely not the way to go, but there may be legit uses for it, although in most cases when you really need to draw SDL_Surfaces on 3D it may be more efficient and convenient to do the surfce->texture "manually" and then use the texture anyway you please. (e.g. it's really straight forward to use smpeg to play an mpeg file onto a texture and then use the texture anywhere you like and not just as flat 2D among your 3D stuff, but perhaps on a TV monitor in your 3D world. wether smpeg is the way to go with movie files is another thing.) cheers, Tommi Kyntola JonasScholz at web.de wrote:
|
|||||||||||||||
|