When looking on the web at various tutorials, I have seen two main different ways OpenGL is implemented, and I was wondering if someone could tell me what the difference is.
The first way (and the easiest way to implement it seems to me) is when you use the main OpenGL functions. Here's an example:
int main(int argc, char **argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA);
glutInitWindowPosition(100,100);
glutInitWindowSize(640,360);
glutCreateWindow("My Window");
glutKeyboardFunc(keyPressed);
glutDisplayFunc(myDisplay);
glutReshapeFunc(myReshape);
glutMainLoop();
return(0);
}
This method you just make the functions you passed in, and have them do what you want, and it seems uncomplicated and easy to do. But then there is the other method, which goes about implimenting OpenGL by first going through all the windows stuff. It has the functions like:
HDC hDC=NULL;
HGLRC hRC=NULL;
HWND hWnd=NULL;
HINSTANCE hInstance;
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
and things like that, and doesn't use many of the opengl functions described above, yet you still use the opengl drawing functions.
I was wondering what the difference was, and what (if any) the advantage of using the more complicated second method is? It seems to require a lot more lines of code, but does it have some advantage?