I am trying to create an application that will need to use double buffering (for purpose of vsync). I am using SDL.NET. From what I understood, in order to have double buffering, I have to SetVideoMode with the opengl paremeter set to true.

Here's the code I'm using:


        Video.GLSetAttribute(OpenGLAttr.DoubleBuffer, 1);
        Video.GLSetAttribute(OpenGLAttr.SwapControl, 1);
        Video.GLSetAttribute(OpenGLAttr.RedSize, 8);
        Video.GLSetAttribute(OpenGLAttr.GreenSize, 8);
        Video.GLSetAttribute(OpenGLAttr.BlueSize, 8);
        Video.GLSetAttribute(OpenGLAttr.DepthSize, 16);

        Video.SetVideoMode(VideoInfo.ScreenWidth, VideoInfo.ScreenHeight, false, true, true, true);

If 4th parameter (bool opengl) is false, it works: a new fullscreen window is created and displayed (but I assume the OpenGLAttr's set above are meaningless in this case).

If 4th parameter is true, nothing happens. A new window gets created (at least, it appears in the list of open windows) but I cannot alt-tab into it and nothing appears on the screen.

What am I doing wrong?


Okay, I see that the problem was, I didn't output anything on the screen - doing Video.GLSwapBuffers() made the black screen appear.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.