问题描述
我对OpenGL的一些基本点/问题,而不是所有涉及code,但概念也是如此。我将不胜感激,如果你能回答,确认或扩大对其中任何一个。我警告你,有些人可能很幼稚,所以请多多包涵。
-
据我了解,OpenGL是一个标准,而不是一个软件。例如,'得到'的OpenGL实际上涉及得到一个它不一定有第三方实现必须由Khronos的认可。
-
的OpenGL通常指的GL工具(GLU)和GL公用事业工具包(GLUT)的结合。他们有方法开头
GLU
和过剩
,RESP。与基本的OpenGL的方法,与简单的GL
,都是由那些让显卡驱动程序,即NVIDIA? 开始实施 -
我认为
过剩
方法是特定于操作系统的帮手,例如glutKeyboardFunc()
有是,国米preT键盘。所以,如果我想要一个更强大的替代的方式来跨preT键盘输入,我只想用的OS API。 OpenGL的本身纯粹是大约图形,但过剩
的这样的事情,因为显卡并不多没有实时人类的控制。 -
在我看来,那
GLU
方法可以等同于调用了一系列低级GL
方法。一个例子我想引用是glOrtho()
和gluPerspective()
。他们似乎对我有工作类似的方法,但计算的角度可能更复杂,所以gluPerspective()
是方便,但可能只是解决一些GL
方法。 -
我研究使用freeglut在大学基本的OpenGL和我一直具有使用OpenGL的骨灰级的方式这一愿景,只使用低级别的方法。我不知道这是否是太傻太天真想法,但有写的OpenGL的专业的方式,来获得其最大的功能?就像,presumably,游戏开发者不会使用
glutPostRedisplay()
例如,对不对?这似乎太容易和方便,喜欢它隐藏了很多是怎么回事的。我怀疑这也是对C ++如此,因为GLUT回调是在命名空间的方法不友善(正如我在其他问题见过)。
Indeed.
No. OpenGL is just the functions beginning with gl…
. Everything else (GLU, GLUT) are third party libraries, not covered by OpenGL.
Correct. GLUT is a very minimal framework, so using something else is strongly recommended.
I think you refer to gluOrtho2D
but yes, you're correct. glOrtho
is a true OpenGL-1 function. In some way, gluOrtho2D
is one of the most useless functions ever:
void gluOrtho2D(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top)
{
glOrtho(left, right, bottom, top, -1, 1);
}
Right again, but it's actually quite simple:
gluPrespective(GLfloat fov, GLfloat aspect, GLfloat near, GLfloat far)
{
GLfloat a = 0.5 * atan(fov);
glFrustum(-a*near, a*near, -a*near/aspect, a*near/aspect, near, far);
}
Starting with OpenGL-3 core, the whole matrix manipulation stuff has been removed. In any serious application it's of little use, since you'll manage the matrices yourself anyway.
Yes this is possible and most game engines indeed do all the grunt work themself. There is libSDL, which also covers OpenGL. Personally I prefer GLFW or doing the stuff myself, indeed. However this does not change the way one uses OpenGL itself. But this is just infrastructure, and it's mostly just writing boilerplate code. As a beginner you gain only very little by not using an established framework. If your program makes heavy use of GUI widgets, then using Qt or GTK, with its embedded OpenGL widget is a reasonable choice.
However some projects are very hardcore, and implement the whole GUI with OpenGL, too. Blender is the most extreme example, and I love it.
GLUT callbacks are okay with namespaces (a namespace is just a C++ compilation time thing). But what's not possible is passing class instance methods as GLUT/C callbacks.
这篇关于OpenGL的理解的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!