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



#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

Change the following lines


void main(int argc, char **argv)
{
	glutInit(&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

Try sending the address of argc to glutInit so:

glutInit(&argc, argv);

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