在没有GLUT的情况下初始化OpenGL
我能找到的每个介绍和示例似乎都使用GLUT或其他框架来初始化" OpenGL.有没有一种使用GL和GLU中可用的东西来初始化OpenGL的方法?如果没有,那么没有它,GLUT怎么办呢?
every introduction and sample that I can find seems to use GLUT or some other framework to "initialize" OpenGL. Is there a way of initializing OpenGL with just what is available in GL and GLU? If not, then what is GLUT doing that is not possible without it?
正如卢克所说,创建和绑定上下文的代码特定于每个窗口平台.
As luke noted, the code to create and bind the context is specific to each windowing platform.
以下是一些在特定平台上初始化OpenGL的功能:
Here are some functions to get you started in terms of initializing OpenGL on specific platforms:
Windows(教程位于此处)
Windows (a tutorial is here)
- wglCreateContext(hDC)
Mac OS X – OS X本质上具有三个选项:Carbon,Cocoa和基础Core Graphics Layer
Mac OS X -- OS X has essentially three options: Carbon, Cocoa, and the underlying Core Graphics Layer
- 有关Mac OS X OpenGL开发的完整指南
- 碳:aglCreateContext
- 可可粉:创建(或子类化)NSOpenGLView.他们创建了自己的上下文,您可以阅读他们的方法文档以了解如何使其保持最新.
- CoreGraphicsLayer :CGLCreateContext
- The entire guide for Mac OS X OpenGL development
- Carbon: aglCreateContext
- Cocoa: Create (or subclass) an NSOpenGLView. They create their own context, and you can read their method documentation to find how to make it current.
- CoreGraphicsLayer: CGLCreateContext
Linux
- glx :glXCreateContext
- glx: glXCreateContext