Is this OpenGL or GLUT?

Started by
1 comment, last by Drew_Benton 15 years, 6 months ago
In some code I have:

//Create the window
glutCreateWindow("Basic Shapes - videotutorialsrock.com");
initRendering(); //Initialize rendering
	
//Set handler functions for drawing, keypresses, and window resizes
glutDisplayFunc(drawScene);
glutKeyboardFunc(handleKeypress);
glutReshapeFunc(handleResize);

But is initRendering() a glut function or an OpenGL function? I know that all opengl functions start with 'gl' and that all glut functions start with 'glut', so where does initRendering() belong?
Advertisement
Quote:Original post by mlt
In some code I have:

*** Source Snippet Removed ***

But is initRendering() a glut function or an OpenGL function?

I know that all opengl functions start with 'gl' and that all glut functions start with 'glut', so where does initRendering() belong?
It's neither. It's a function you define.
Quote:Original post by mlt
In some code I have:

*** Source Snippet Removed ***

But is initRendering() a glut function or an OpenGL function?

I know that all opengl functions start with 'gl' and that all glut functions start with 'glut', so where does initRendering() belong?


initRendering is a user defined function. As you can see on their web page, it is just a custom function that will call "setup code".

Quote:
//Initializes 3D renderingvoid initRendering() {    //Makes 3D drawing work when something is in front of something else    glEnable(GL_DEPTH_TEST);}


The initRendering function initializes our rendering parameters. For now, it doesn't do much. We'll pretty much always want to call glEnable(GL_DEPTH_TEST) when we initialize rendering. The call makes sure that an object shows up behind an object in front of it that has already been drawn, which we want to happen.


Hope that makes sense. It can go anywhere in your CPP file as long as you have a function prototype defined for it at the top of the program.

This topic is closed to new replies.

Advertisement