why include windows?

Started by
2 comments, last by Ainokea 20 years ago
If opengl is cross platform howcome the opengl tutorial in nehe #include "windows.h" ? I dont mind i have windows xp. I was just wondering.
______________________________________________________________________________________With the flesh of a cow.
Advertisement
Because the tutorials were compiled on windows, and the GL headers (in MSVC at least) have this annoying quirk that they use some #defines from windows.h.
OpenGL is crossplatform. But window creation is not. For that you use OS specific code or use something like GLUT.

You should never let your fears become the boundaries of your dreams.
You should never let your fears become the boundaries of your dreams.
Microsoft''s OpenGL implementation uses GDI macros in the GL/gl.h header and requires that they be defined before the header is included, hence the need to include windows.h before GL/gl.h. Since it''s only that OpenGL implementation that requires that, feel free to wrap the windows.h inclusion in a preprocessor test to only do it when necessary (less global-namespace-poluting solutions exist too, by avoiding the need for windows.h, but they''re more difficult).

This topic is closed to new replies.

Advertisement