在没有 GLUT 的情况下初始化 OpenGL [英] Initializing OpenGL without GLUT

查看:37
本文介绍了在没有 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?

推荐答案

正如 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

  • 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屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆