[SDL] SDL_Window suggestion
masonwheeler at yahoo.com
Mon Apr 20 06:11:38 PDT 2009
-----BEGIN PGP SIGNED MESSAGE-----
You're confusing two concepts. If you want hardware accelerated
rendering, opengl will almost always be hardware (it's generally safe to
assume so). OpenGL does not use surfaces to render, so it doesn't
matter whether or not your surfaces are hardware, you'll need to use
opengl textures anyway.
If you want to use SDL surfaces with OpenGL acceleration, you'll need to
use SDL 1.3 since SDL 1.2 doesn't do that. SDL 1.3 is still a
To sum it up:
* Don't worry about HWSURFACEs - I believe they are deprecated anyway.
* If you still want to use surfaces use SDL 1.3
* If you want to use OpenGL directly instead, you can use SDL 1.2, but
you will have to use textures not surfaces.
Abhishek Gupta wrote:
> Hi all,
> I would like to be able to use SDL + OpenGL and get hardware rendering on
> I believe there have been previous posts about this topic, but I cant seem
> to be able to find a satisfactory answer.
> According to the following posts, hardware rendering is not supported by SDL
> (I tried using dga, but that resulted in SDL_Init(SDL_INIT_VIDEO) failing.)
> And according to the following tutorial, SDL would use OpenGL's hardware
> rendering, if I pass SDL_OPENGL as the flag in SDL_SetVideoMode:
> So which is it? Can I get hardware acceleration with SDL or not?
> I am using a Dell Inspiron 1525 laptop with Intel 965 express chipset
> running Fedora 10.
> Here is the output of lspci | grep -i vga:
> 00:02.0 VGA compatible controller: Intel Corporation Mobile GM965/GL960
> Integrated Graphics Controller (rev 0c)
> And here is the output of glxinfo | grep -i render:
> direct rendering: Yes
> OpenGL renderer string: Mesa DRI Intel(R) 965GM GEM 20080716 x86/MMX/SSE2
> When I try to run the Nehe's SDL code (
> http://nehe.gamedev.net/data/lessons/linuxsdl/lesson01.tar.gz), I get only a
> software surface and hardware blits is (blit_hw) is not available.
> The relevant portion of code is shown below (I added the printfs to see what
> is happening):
> videoInfo = SDL_GetVideoInfo( );
> if ( !videoInfo )
> fprintf( stderr, "Video query failed: %s\n",
> SDL_GetError( ) );
> Quit( 1 );
> /* the flags to pass to SDL_SetVideoMode */
> videoFlags = SDL_OPENGL; /* Enable OpenGL in SDL */
> videoFlags |= SDL_GL_DOUBLEBUFFER; /* Enable double buffering */
> videoFlags |= SDL_HWPALETTE; /* Store the palette in hardware */
> videoFlags |= SDL_RESIZABLE; /* Enable window resizing */
> /* This checks to see if surfaces can be stored in memory */
> if ( videoInfo->hw_available )
> printf("Hardware surface available\n");
> videoFlags |= SDL_HWSURFACE;
> printf("Software surface available\n");
> videoFlags |= SDL_SWSURFACE;
> /* This checks if hardware blits can be done */
> if ( videoInfo->blit_hw )
> printf("Hardware blits can be done\n");
> videoFlags |= SDL_HWACCEL;
> And the output I get is:
> Software surface available
> 973 frames in 5.001 seconds = 194.561 FPS
> If I use the GLX version of the same tutorial (
> http://nehe.gamedev.net/data/lessons/linuxglx/lesson01.tar.gz), I do get
> hardware rendering
> Relevant portion of the code:
> if (glXIsDirect(GLWin.dpy, GLWin.ctx))
> printf("Congrats, you have Direct Rendering!\n");
> printf("Sorry, no Direct Rendering possible!\n");
> I get the output "Congrats, you have Direct Rendering!\n" with this.
> I would prefer to use SDL but I really want hardware acceleration.
> Any help, pointers, tips are much appreciated.
> Thanks and Regards,
> SDL mailing list
> SDL at lists.libsdl.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
-----END PGP SIGNATURE-----
More information about the SDL