Openglblit

Hi,

SDL is relatively new to me, and I found the OPENGLBLIT feature very interesting. It’s much easier to blit 2D images to the screen than using an ortho projection and textures. I’m using it to display text on the screen. But the late SDL versions are saying that feature is deprecated, and that I should use the second mentioned method instead of OPENGLBLIT. Why is that? What are the drawbacks of OPENGLBLIT?

If it’s really a hack to blit into the framebuffer, the only drawback I can think of is portability. If so, how portable is OPENGLBLIT currently? I need it to work on IRIX :o)

Thanks!
Thiago

It is very slow compared to glortho method.
So it eats lot of your per frame rendering time.On Monday 24 February 2003 15:18, Thiago Bastos wrote:

Hi,

SDL is relatively new to me, and I found the OPENGLBLIT feature very
interesting. It’s much easier to blit 2D images to the screen than
using an ortho projection and textures. I’m using it to display text
on the screen. But the late SDL versions are saying that feature is
deprecated, and that I should use the second mentioned method instead
of OPENGLBLIT. Why is that? What are the drawbacks of OPENGLBLIT?

If it’s really a hack to blit into the framebuffer, the only drawback
I can think of is portability. If so, how portable is OPENGLBLIT
currently? I need it to work on IRIX :o)

It is very slow compared to glortho method.
So it eats lot of your per frame rendering time.

Is this a general case, or just at specific situations?
I used the testgl.c program to compare the performance of both methods and they run at practically the same framerate (358 for -logoblit and 362 for -logo).

I have a GF2MX and WinXP.

Would this be worse in other systems such as IRIX (and btw does IRIX at least support OPENGLBLIT?)?

OPENGLBLIT simplifies things a lot for me, and when SDL support multiple displays I won’t have to manage the textures across multiple contexts, it could be as simple as bliting twice.

All advices are welcome :o)
I’m still coding that part of my project so now is the time to decide which method I should go with.

Thanks,
Thiago

Hi,

SDL is relatively new to me, and I found the OPENGLBLIT feature
very interesting. It’s much easier to blit 2D images to the screen
than using an ortho projection and textures. I’m using it to
display text on the screen. But the late SDL versions are saying
that feature is deprecated, and that I should use the second
mentioned method instead of OPENGLBLIT. Why is that? What are the
drawbacks of OPENGLBLIT?

It’s slow and basically nothing but abuse of your hardware. It’s a
hack originally created to get a commercial game running with less
work, and is not intended for “serious” use.

Try glSDL (http://olofson.net/mixed.html), or use OpenGL directly.

glSDL isn’t really meant to be used together with native OpenGL code,
but you might find parts of the code useful. Or just hack it so it
doesn’t screw up your OpenGL state… (Since it’s actually an SDL 2D
API implementation on top of OpenGL, it assumes that applications
will not use OpenGL directly while using glSDL.)

If it’s really a hack to blit into the framebuffer, the only
drawback I can think of is portability.

No, it’s much worse than that. Every single blit means that your
surface has to me “streamed” to the screen through a single 256x256
texture - and guess what: Many OpenGL implementations lack busmaster
DMA for system->VRAM transactions, so this can be about as slow as
unaccelerated SDL 2D.

If so, how portable is
OPENGLBLIT currently? I need it to work on IRIX :o)

I think it should be quite portable, but why bother? If you’re using
OpenGL anyway, you need OpenGL - so you might as well use it
properly. It’s not too hard, and it will avoid your application
slowing down to a crawl with certain drivers.

//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 Monday 24 February 2003 14.18, Thiago Bastos wrote:

No, it’s much worse than that. Every single blit means that your
surface has to me “streamed” to the screen through a single 256x256
texture - and guess what: Many OpenGL implementations lack busmaster
DMA for system->VRAM transactions, so this can be about as slow as
unaccelerated SDL 2D.

Ouch… I’ve just finished converting everything to native OpenGL code.

Thanks, again!
Thiago

Hi,

Does anybody here knows the reason why , when using

_surface = SDL_SetVideoMode(surfaceSize[0], surfaceSize[1], 24,  

SDL_NOFRAME | SDL_OPENGLBLIT);
instead of
_surface = SDL_SetVideoMode(surfaceSize[0], surfaceSize[1], 24,
SDL_NOFRAME );

any further call to

      SDL_UpdateRect(_surface, 0, 0, _surface->w, _surface->h);

does not redraw my surface ? I’ve been trying to swap the buffers (
SDL_GL_SwapBuffers() ) , just in case … didn’t work either.

BTW, my GL attributes are as follow :

SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 5);
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 16);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 16);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);

Thanks for any help, idea …

R?my–
Remy Deslignes

Ingenieur Developement / Software Engineer

Tel: +33 (1) 53.90.11.19

===========================================
Silicon Worlds S.A.
12, rue de Chatillon
75014 Paris France
Tel: +33 (01) 53.90.11.11
Fax: +33 (01) 53.90.11.12
http://www.silicon-worlds.fr

SDL_OPENGLBLIT is deprecated (and broken)… don’t use it!On Mon, 07 Feb 2005 11:01:52 +0100, R?my Deslignes wrote:

Hi,

Does anybody here knows the reason why , when using

_surface = SDL_SetVideoMode(surfaceSize[0], surfaceSize[1], 24,

SDL_NOFRAME | SDL_OPENGLBLIT);
instead of
_surface = SDL_SetVideoMode(surfaceSize[0], surfaceSize[1], 24,
SDL_NOFRAME );

any further call to

      SDL_UpdateRect(_surface, 0, 0, _surface->w, _surface->h);

does not redraw my surface ? I’ve been trying to swap the buffers (
SDL_GL_SwapBuffers() ) , just in case … didn’t work either.

BTW, my GL attributes are as follow :

SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 5);
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 16);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 16);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);

Thanks for any help, idea …

R?my


Remy Deslignes

Ingenieur Developement / Software Engineer

Tel: +33 (1) 53.90.11.19

===========================================
Silicon Worlds S.A.
12, rue de Chatillon
75014 Paris France
Tel: +33 (01) 53.90.11.11
Fax: +33 (01) 53.90.11.12
http://www.silicon-worlds.fr


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