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 5 of 5

Thread: OpenGL Error

  1. #1
    Intern Newbie
    Join Date
    Jan 2011
    Location
    Australia, Western Australia
    Posts
    37

    OpenGL Error

    Hello, Been looking through some OpenGL tutorials and I've hit a problem with the most basic of things and i have No idea what the problem is...

    the code is

    Code :
     
    #include <stdlib.h>
    #include <gl/glut.h>
     
    void renderScene()
    {
    	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    	glBegin(GL_TRIANGLES);
    		glVertex3f(-0.5,-0.5,0);
    		glVertex3f(0.5,0.0,0.0);
    		glVertex3f(0.0,0.5,0.0);
    	glEnd();
    	glFlush();
    }
     
     
    void main(int *argc, char **argv)
    {
    	glutInit(argc, argv);
    	glutInitWindowPosition(100,100);
    	glutInitWindowSize(660,430);
    	glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH);
    	glutCreateWindow("Glut Window Test");
    	glutDisplayFunc(renderScene);
    	glutMainLoop();
    }

    and my Error is


  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Mar 2009
    Location
    Singapore
    Posts
    802

    Re: OpenGL Error

    Quote Originally Posted by Joshhua5
    Hello, Been looking through some OpenGL tutorials and I've hit a problem with the most basic of things and i have No idea what the problem is...

    the code is

    Code :
    code stripped for space concerns

    and my Error is

    [img]image removed for space concerns[/img]
    Change the following lines
    Code :
    void main(int argc, char **argv)
    {
    	glutInit(&amp;argc, argv);

    argc is the total number of command line args passed into ur program its not an int pointer just an int variable.
    you pass this argc int variable as a pointer to glutInit.

    Hope this helps,
    Mobeen
    Regards,
    Mobeen

  3. #3
    Junior Member Newbie
    Join Date
    Jan 2011
    Posts
    5

    Re: OpenGL Error

    Try sending the address of argc to glutInit so:

    Code :
    glutInit(&amp;argc, argv);

  4. #4
    Intern Newbie
    Join Date
    Jan 2011
    Location
    Australia, Western Australia
    Posts
    37

    Re: OpenGL Error

    Thank you, and I'll like to say
    the tutorial is Doing it wrong.

  5. #5
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    2,882

    Re: OpenGL Error

    Quote Originally Posted by Joshhua5
    Thank you, and I'll like to say the tutorial is Doing it wrong.
    Which tutorial? Let's ping the author so they can get it fixed.

    Best I can tell, that tutorial isn't on the opengl.org web site: search link

Posting Permissions

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