Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Why does almost every book on OpenGL teach or discuss the API in the context of Win32 API?

Is Win32 API necessary to learn OpenGL Game Programming?

share|improve this question
    
Really not one has anything to do with the other. I assume you're referring to Astle. Book authors might tend to write using the O/S combination they think their target audience has (ie they think they can sell more copies if the teach OpenGL/Win32, as opposed to OpenGL/Mac or OpenGL/Linux.) The Red Book doesn't even cover O/S, so there's that.. –  bobobobo May 4 '12 at 20:01
4  
Why almost every book on OpenGL teaches or discusses the API in the context of Win32 API? OBJECTION! Fact not in evidence. I've seen many OpenGL books that use an abstraction layer for creating an OpenGL window. –  Nicol Bolas May 4 '12 at 20:27
add comment

3 Answers

OpenGL itself is platform-netrual. In order to maintain that neutrality however, OpenGL expunged anything platform specific. Like creating a window. Or managing a window. Or creating OpenGL itself.

Yes, the API does not explain how to create it. Only how to use it once created.

The creating of an OpenGL context is something that is done using platform-specific APIs. On Windows, this means using the Win32 API to create and manage a window. On Linux, this requires using X11 or something similar. And so forth.

Now, there are many, many platform-neutral wrappers around these APIs that allow you to create and manage an OpenGL window without touching platform-specific code directly. But that platform-specific code still exists; it's just hidden from sight.

share|improve this answer
add comment

OpenGL is independent of Win32 API. OpenGL is compatible with other platforms (Linux, MacOSX, iOS, ...) where the Win32 API is not even present.

You can use glut to manage your window and create your OpenGL context in a platform independent way, and learn OpenGL without any knowledge of Win32 API.

share|improve this answer
add comment

I have found GLUT much easier to work with if you are just starting to learn OpenGL. After you have some experience you can move onto Win32 API. Although not necessary the knowledge will never be a waste, not to mention it will also make it easier to understand other advanced Windowing/GUI systems.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.