Results 1 to 6 of 6

Thread: glutInitDisplayMode(GLUT_SINGLE) doesn't work?

  1. #1
    Newbie Newbie
    Join Date
    Mar 2014
    Posts
    3

    glutInitDisplayMode(GLUT_SINGLE) doesn't work?

    I am new for OPENGL.
    environment is WIN7 64 + vs2010.
    I'm sure that the problem is nothing concerned with the software environment.
    In my laptop,glutInitDisplayMode(GLUT_SINGLE) doesn't work
    I have to use glutInitDisplayMode(GLUT_double) to make the results all right.
    let me give you an eample:

    #include<gl/glut.h>
    void renderScene(void)
    {
    glClear(GL_COLOR_BUFFER_BIT);
    glBegin(GL_POLYGON);
    glVertex2f(-0.5, -0.5);
    glVertex2f(-0.5, 0.5);
    glVertex2f(0.5, 0.5);
    glVertex2f(0.5, -0.5);
    glEnd();
    glFlush();
    }
    int main(int argc, char** argv){
    glutCreateWindow("simple");
    glutDisplayFunc(mydisplay);
    glutMainLoop();
    }

    codes above operated in my laptop only show all white,title is right but no black background and no square.
    But if i use glutInitDisplayMode(GLUT_double) and glutSwapBuffers(); everything is right.
    why this happened? is it resulted from my graphics card?Is there any thing i can do to revise the problem?

  2. #2
    Newbie OpenGL Pro
    Join Date
    Jan 2007
    Posts
    1,789
    Single buffered modes are problematic since the introduction of WDDM and desktop compositing in Windows Vista. To be honest this isn't a problem - there's no real valid reason to use a single buffered mode and double buffered modes aren't particularly advanced or difficult to set up or manage, so just create double buffered modes instead.

  3. #3
    Senior Member Regular Contributor Agent D's Avatar
    Join Date
    Sep 2011
    Location
    Innsbruck, Austria
    Posts
    281
    You could try calling glFlush( ) at the end of the drawing functions with a singlebuffered context. I once had a similar issue with GLX (see here)

  4. #4
    Newbie Newbie
    Join Date
    Mar 2014
    Posts
    3
    Sorry for that I wrote it wrong in codes above,I have fixed it.Single buffered with glFlush() just doesn't give an expected result.

  5. #5
    Newbie Newbie
    Join Date
    Mar 2014
    Posts
    3
    Quote Originally Posted by mhagain View Post
    Single buffered modes are problematic since the introduction of WDDM and desktop compositing in Windows Vista. To be honest this isn't a problem - there's no real valid reason to use a single buffered mode and double buffered modes aren't particularly advanced or difficult to set up or manage, so just create double buffered modes instead.
    Thanks that u telling me these,however there must be some differences between my computer with others . I wonder if it will lead other problems?

  6. #6
    Newbie OpenGL Pro
    Join Date
    Jan 2007
    Posts
    1,789
    Quote Originally Posted by sk5065 View Post
    Thanks that u telling me these,however there must be some differences between my computer with others . I wonder if it will lead other problems?
    Maybe, maybe not. I doubt there is a difference - you have standard hardware, a widely used OS, presumably you keep your drivers up to date. You're doing everything right.

    The problem is that a lot of GLUT tutorials are old. Really really old. Like 20 or more years old. And back then hardware was different and some hardware might not support a double-buffered context. But a single-buffered context would work on everything, so these really really old GLUT tutorials for really really old hardware used single-buffered contexts. Time passes, hardware changes, drivers change, but GLUT tutorials are never updated properly so they're no longer suitable to modern hardware.

Similar Threads

  1. second UBO doesn't work
    By mlkn_mlkn in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 05-11-2015, 12:34 PM
  2. Lighting used to work, but now it doesn't
    By 147-2 in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 10-07-2003, 03:51 PM
  3. It doesn't work...
    By GunCraP in forum OpenGL: User Software
    Replies: 0
    Last Post: 01-03-2003, 01:46 AM
  4. Why doesn't this work
    By in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 04-11-2002, 02:25 AM
  5. Lighting doesn't work :(
    By Ysaneya in forum OpenGL: Advanced Coding
    Replies: 3
    Last Post: 04-25-2000, 12:20 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean