在 Linux 上设置 OpenGL 以进行 gtkmm 和交叉编译
我正在开始学习 OpenGL,但我不确定如何在 (Ubuntu) Linux 上设置它。
我认为这可能是一种方式:
OpenGL只是一种图形语言规范(或接口),要正确使用它,我必须下载一些实现<的库(针对特定操作系统)< OpenGL 规范。
经过长时间的搜索和多种来源的研究,我发现 Mesa 3D 图形库最适合我。
我还找到了 SDL(简单 DirectMedia Layer)库,但它似乎是一个除了图形之外的所有其他东西的库(例如 GUI、声音、键盘和鼠标输入,...)。我只需要一个图形库,这样它就能实现 OpenGL 规范。
作为图形用户界面,我使用 Gtkmm 库,到目前为止我对它“非常满意”,所以我想将 gtkmm 与 OpenGL“连接” - 为此,我找到了一个名为 gtkglextmm 的 gtkmm 库扩展gtkglextmmDrawingArea)(但我还没有尝试过,所以我希望它能工作:- ))。
最后一个问题是从Linux到Windows的交叉编译(使用MinGW交叉编译器)。到目前为止,我已经成功地交叉编译了我使用 Gtkmm 库完成的所有工作(从 Linux 到 Windows)。
当我将它与OpenGL结合起来时,交叉编译它不会有任何问题吗(例如,在使用Gcc编译器编译时我是否需要链接一些特殊的东西,或者我应该在我的应用程序中分发一些Windows OpenGL库)?
如果您确认我正朝着正确的方向前进,或者让我朝着正确的方向前进,我会非常高兴我可以以更简单或更好的方式做一些事情。
I am starting learning OpenGL and I am not sure, how to set it up on (Ubuntu) Linux.
I think that this could be a way:
OpenGL is only a graphics language specification (or interface) and to properly use it I have to download some library (for the specific OS) that implements the OpenGL specification.
After long searching and from multiple sources I found that the Mesa 3D Graphics Library would be the best for me.
I also found the SDL (Simple DirectMedia Layer) library but it seems to be a library for all other things beside graphics (e.g. GUI, sound, keyboard and mouse input, ...). I need ONLY a graphics library, so that it will implement the OpenGL specification.
As a graphical user interface I use the Gtkmm library and I am "very satisfied" with it so far, so I would like to "connect" gtkmm with OpenGL - for that I found an extension to gtkmm library called gtkglextmm
by means of which I should be able to draw the OpenGL animation to a window (or DrawingArea
in Gtkmm jargon) in GUI (but I have not tried it yet so I hope it will work :-) ).
And the last problem is the cross compilation from Linux to Windows (with the MinGW cross compiler). So far, I have successfully cross compiled (from Linux to Windows) all my work done with the Gtkmm library.
When I combine it with OpenGL, won't it be any problem to cross compile it (e.g. do I need to link something special when compiling with the Gcc compiler, or should I distribute some Windows OpenGL library with my application)?
I would be very pleased I you confirmed that I am in the right direction or turned me in the right direction that I could done something easier or better way.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
在某种程度上,其依赖于显卡,专有驱动程序包包括自己的 libGL.so,还包括 libGL.la(链接到 .so)和任何相关的头文件。
如果您使用的是 Intel 或 Matrox 卡,或者您正在运行带有 rage、radeon 或 radeonhd 驱动程序的 ATi 卡,那么您正在使用开源驱动程序。
GLUT 将是通向工作程序的最短路径。否则,您需要自己编写代码来创建 OpenGL 上下文(特定于操作系统)。
如果您仍然遇到问题,请告诉我们更多关于哪些内容不适合您的信息。
编辑以下是一些可能相关或有用的示例命令/代码。
GCC 编译:
包括:
To some extent its graphics card dependent, the proprietary driver packs include their own libGL.so and also include the libGL.la (to link against the .so) and any relevant header files.
If you're using an Intel or Matrox card, or you're running an ATi card with the rage, radeon or radeonhd driver you're using the Open Source drivers.
GLUT will be the shortest path to a working program. Otherwise you'll need to write the code to create the OpenGL context (OS specific) yourself.
If you're still having issues, let us know more about whats not working for you.
EDIT Here's some sample commands/code that might be relevant or useful.
GCC Compiling:
Includes:
如果有合适的软件包,它应该可以开箱即用。
也就是说,这里是 Build-Depends 的相关块:用于构建 rgl< /a> 包(在 OpenGL 设备上为 R 提供)位于 Debian。由于 Ubuntu 使用相同的设置来构建软件包,因此您应该真正设置:
|
表示替代,因此您可以使用基于台面的软件包或与您的显卡匹配的软件包(例如各种 nvidia-* 软件包)。只需从某处获取一些 OpenGPl 示例并尝试一下即可。
It should all just work out of the box given the right packages.
That said, here is the relevant chunk of the Build-Depends: used to build the rgl package (which provides on OpenGL device for R) on Debian. As Ubuntu uses the same settings for their build of the package, you should really bet set:
The
|
means alternative, so you can use the mesa-based packages or ones matching your graphics card (like the various nvidia-* packages).Just grab some OpenGPl examples from somewhere and try it.
你正朝着正确的方向前进。我使用 Eclipse CDT+ SDL + openGL 在 Ubuntu Linux 下开发我的应用程序(我使用本教程进行设置: http://www.ferdychristant.com/blog/articles/DOMM-72MPPE),然后使用 Dev C++ 在 Windows 下成功编译我的应用程序
You are going right direction. I used Eclipse CDT+ SDL + openGL for developing my app under Ubuntu Linux (I used this tutorial for setup: http://www.ferdychristant.com/blog/articles/DOMM-72MPPE) and then successfully compiled my app under Windows with Dev C++
我在 Linux 领域没有多大帮助。而且在 OpenGL 方面我已经落后于时代了。然而,看起来 NeHe 有一套新的教程,他们正在将这些教程放在一起一些不错的基本代码。
正如他们在网站上所说:
所以我强烈建议至少尝试一下他们的代码。 NeHe 有着创建一些非常好的教程的悠久传统。
I'm not of much help in the Linux realm. And I'm behind the times when it comes to OpenGL. However, it looks like NeHe has a new set of tutorials where they're putting together some nice base code.
As they say on the site:
So I'd highly recommend at least giving their code a try. NeHe has a long standing tradition of creating some very nice tutorials.