View Full Version : how to create OpenGL function in class?

02-12-2009, 04:18 AM
Hi, i'm gOzaru.
i am a new beginner in OpenGL programming.
i would like to make a class where it has OpenGL function, and i could call it when i want to use it.
but i don't know how to create it.
Could any of u help me?
Thank u very much.

02-14-2009, 11:16 AM
OpenGL functions are normal C functions, and they behave like any other C function. You can call them from anywhere, provided you include gl.h. You class can have a method, just like any other method, except that it calls OpenGL functions like glEnable() instead of strcmp(). Make sure that you have an OpenGL context (window) open and setup before you try to do OpenGL things.

02-14-2009, 07:57 PM
PS : if you want to use high version of GL you will use GLEW or GLEE, but you should have bind a GL context to current thread.

02-15-2009, 01:59 AM
If" Make sure that you have an OpenGL context (window) open and setup" sounds complex to you, use GLUT or GLFW.