Jump to content
  • Advertisement
Sign in to follow this  
mlt

OpenGL Is this OpenGL or GLUT?

This topic is 3658 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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 rendering
void 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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!