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)
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA);
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:
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?
ok heres the difference's
on the first:
its a platform independant library called the GLut OpenGL Utility Toolkit its used to handle all the window code for you and the same code will run on virtually any Operating System.
this does limit you in a few ways but it depends on what you want to do with gl, whether you'll wan't to use GLut.
on the second:
its win32 code used to setup a GL window for Windows only
while this gives a little more flexibility it is many more lines of code and a bit more complicated that GLut.
use Glut if your starting out and wan't to learn GL with out the hassels of Win32.
if you know Win32 already then either is fine.
>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?<
Win32 is slightly faster and gives more control to the programmer but is only for Windows and it's more complicated to use.