在没有 GLUT 的情况下初始化 OpenGL [英] Initializing OpenGL without GLUT
问题描述
我能找到的每个介绍和示例似乎都使用 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?
推荐答案
正如 luke 所指出的,创建和绑定上下文的代码特定于每个窗口平台.
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 和底层核心图形层
Mac OS X -- OS X has essentially three options: Carbon, Cocoa, and the underlying Core Graphics Layer
- Mac OS X OpenGL 开发完整指南
- 碳:aglCreateContext
- Cocoa:创建(或子类化)一个 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
这篇关于在没有 GLUT 的情况下初始化 OpenGL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!