Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: Open GL errors

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2003
    Location
    Fayetteville, Ar , 72702
    Posts
    24

    Open GL errors

    I Tried making a class using the exmaple of lesson 2 from NeHe tutorial....but get the following errors...could you please tell how to get around this problem.
    Error : function call 'glutDisplayFunc(void)' does not match
    'glutDisplayFunc(void (*)())'
    myGLObject.cp line 160 glutDisplayFunc(DrawGLScene);
    1.
    Error : function call 'glutReshapeFunc(void)' does not match
    'glutReshapeFunc(void (*)(int, int))'
    myGLObject.cp line 161 glutReshapeFunc(ReSizeGLScene);
    2.

    Error : function call 'glutDisplayFunc(void)' does not match
    'glutDisplayFunc(void (*)())'
    myGLObject.cp line 160 glutDisplayFunc(DrawGLScene);

    Error : function call 'glutReshapeFunc(void)' does not match
    'glutReshapeFunc(void (*)(int, int))'
    myGLObject.cp line 161 glutReshapeFunc(ReSizeGLScene);

    #include"myGLObject.h"

    GLvoid myGLObject::InitGL(GLvoid)
    {

    glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // This Will Clear The Background Color To Black
    glClearDepth(1.0); // Enables Clearing Of The Depth Buffer
    glDepthFunc(GL_LESS); // The Type Of Depth Test To Do
    glEnable(GL_DEPTH_TEST); // Enables Depth Testing
    glShadeModel(GL_SMOOTH); // Enables Smooth Color Shading

    glMatrixMode(GL_PROJECTION);
    glLoadIdentity(); // Reset The Projection Matrix

    gluPerspective(45.0f,(GLfloat)kWindowWidth/(GLfloat)kWindowHeight,0.1f,100.0f); // Calculate The Aspect Ratio Of The Window

    glMatrixMode(GL_MODELVIEW);

    }

    // DrawGLScene ---------------------------------------------------------------

    GLvoid myGLObject: rawGLScene(GLvoid)
    {
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear The Screen And The Depth Buffer
    glLoadIdentity(); // Reset The View

    glTranslatef(-1.5f,0.0f,-6.0f);

    glBegin(GL_POLYGON);
    glVertex3f( 0.0f, 1.0f, 0.0f);
    glVertex3f(-1.0f,-1.0f, 0.0f);
    glVertex3f( 1.0f,-1.0f, 0.0f);
    glEnd();

    glTranslatef(3.0f,0.0f,0.0f);

    glBegin(GL_QUADS);
    glVertex3f(-1.0f, 1.0f, 0.0f);
    glVertex3f( 1.0f, 1.0f, 0.0f);
    glVertex3f( 1.0f,-1.0f, 0.0f);
    glVertex3f(-1.0f,-1.0f, 0.0f);
    glEnd();

    glFlush();
    }

    // ReSizeGLScene ------------------------------------------------------------

    GLvoid myGLObject::ReSizeGLScene(int Width, int Height)
    {
    glViewport (0, 0, (GLsizei) Width, (GLsizei) Height);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();

    gluPerspective(45.0, (GLfloat) Width / (GLfloat) Height, 0.1, 100.0);

    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    }

    // draw object ------------------------------------------------------------
    GLvoid myGLObject::showmyobject(GLvoid){
    setGraphControl();

    InitGL();
    glutDisplayFunc(DrawGLScene);
    glutReshapeFunc(ReSizeGLScene);

    }

    Thank you for your assistance..

  2. #2
    Junior Member Regular Contributor
    Join Date
    Jan 2003
    Location
    Bloomington,MN,USA
    Posts
    141

    Re: Open GL errors

    I think you need to either declare those methods in the class you pass to GLUT static or just avoid classes and use C stile functions instead.

    - Halcyon

  3. #3
    Junior Member Newbie
    Join Date
    Apr 2003
    Location
    Mexico
    Posts
    1

    Re: Open GL errors

    Originally posted by hcrogma:
    I Tried making a class using the exmaple of lesson 2 from NeHe tutorial....but get the following errors...could you please tell how to get around this problem.
    Error : function call 'glutDisplayFunc(void)' does not match
    'glutDisplayFunc(void (*)())'
    myGLObject.cp line 160 glutDisplayFunc(DrawGLScene);
    1.
    Error : function call 'glutReshapeFunc(void)' does not match
    'glutReshapeFunc(void (*)(int, int))'
    myGLObject.cp line 161 glutReshapeFunc(ReSizeGLScene);
    2.

    Error : function call 'glutDisplayFunc(void)' does not match
    'glutDisplayFunc(void (*)())'
    myGLObject.cp line 160 glutDisplayFunc(DrawGLScene);

    Error : function call 'glutReshapeFunc(void)' does not match
    'glutReshapeFunc(void (*)(int, int))'
    myGLObject.cp line 161 glutReshapeFunc(ReSizeGLScene);

    #include"myGLObject.h"

    GLvoid myGLObject::InitGL(GLvoid)
    {

    glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // This Will Clear The Background Color To Black
    glClearDepth(1.0); // Enables Clearing Of The Depth Buffer
    glDepthFunc(GL_LESS); // The Type Of Depth Test To Do
    glEnable(GL_DEPTH_TEST); // Enables Depth Testing
    glShadeModel(GL_SMOOTH); // Enables Smooth Color Shading

    glMatrixMode(GL_PROJECTION);
    glLoadIdentity(); // Reset The Projection Matrix

    gluPerspective(45.0f,(GLfloat)kWindowWidth/(GLfloat)kWindowHeight,0.1f,100.0f); // Calculate The Aspect Ratio Of The Window

    glMatrixMode(GL_MODELVIEW);

    }

    // DrawGLScene

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •