GDC 2006 2D Physics Demo for D
Olli Aalto
oaalto at gmail.com
Tue Oct 31 00:08:51 PST 2006
Jarrett Billingsley wrote:
> "clayasaurus" <clayasaurus at gmail.com> wrote in message
> news:ei6dp6$2i50$1 at digitaldaemon.com...
>> Derelict comes with the demo.zip package along with SDL.dll. If you have
>> the D compiler and build, all you need to do is 'build
>> main.d -Rn -full -release -O' to build it.
>>
>> Throw in an SDL_Delay(40) in the main while loop if you want a quick
>> solution, or add a 'flags = SDL_OPENGL | SDL_FULLSCREEN' to the SDL video
>> flags for fullscreen in main.d around line 668.
>
> Ahh, great, that worked :) So much cooler when it's running at a reasonable
> speed. Though strangely putting it in fullscreen didn't help. Apparently,
> there's a way to make SDL wait until a vertical retrace until it updates the
> screen, using SDL_DOUBLEBUF for the video flags and SDL_Flip() at the end of
> the loop, but I tried that and that didn't help either.
>
>
The SDL_DOUBLEBUF and SDL_Flip() are not used in OpenGL mode. The
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1) and SDL_GL_SwapBuffers() are
used instead respectively. I haven't looked at the code yet, but I
believe those are used there.
As what comes to the vsync you could try
SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 1)[1]. Put it before the call
to SDL_SetVideoMode().
O.
1. http://www.libsdl.org/cgi/docwiki.cgi/SDL_5fGL_5fSetAttribute
http://www.libsdl.org/cgi/docwiki.cgi/SDL_5fGLattr
More information about the Digitalmars-d-announce
mailing list