如何使用 Qt 4 创建 OpenGL 3 上下文? [英] How to Create OpenGL 3 Context with Qt 4?

查看:107
本文介绍了如何使用 Qt 4 创建 OpenGL 3 上下文?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想学习使用 OpenGL 的图形编程.因为我才刚刚开始学习它,所以我决定学习新的/OpenGL3 做事方式.据我所知,必须为此创建一个 OpenGL 3 上下文(如果我理解正确,则在新的 OpenGL 3.2 中的核心配置文件).好吧,我想为此使用 Qt,目前使用版本 4.5.2,因为我已经知道并且喜欢它并且它支持创建 OpenGL 小部件.我遇到的问题是,看起来 OpenGL 小部件总是与旧的 OpenGL 2 上下文一起打包,我看不到使其进入/切换到 OpenGL 3 方式的选项.我是否在这里遗漏了一些明显的东西,或者我是否需要一些更棘手的东西来使用 Qt 创建 OpenGL 3 上下文?当前版本的 Qt 甚至支持它吗?我正在使用 Linux,如果有什么不同的话.

I would like to learn graphics programming with OpenGL. And since I will just start learning it I decided to learn the new/OpenGL3 way of doing things.As far as I can see one has to create an OpenGL 3 context for this (Core profile in the new OpenGL 3.2 if I understand this correctly). Well I thought about using Qt for this, currently using version 4.5.2, since I know it already and like it and it supports creating the OpenGL widget. What I have the problem with is that it looks like the OpenGL widget is always crated with the old OpenGL 2 context and I can't see the option to make it in/switch it to OpenGL 3 way. Am I missing some obvious thing here or do I need something a bit more tricky to create OpenGL 3 context with Qt? Is it even supported in current version of Qt? I'm using Linux, if it makes any difference.

推荐答案

Mesa 软件渲染仍然停留在 OpenGL 2.1 上.如果您使用二进制 NVidia 驱动程序,它们会在足够新的硬件上提供 OpenGL 3.2 support.AMD 的 最新的 fglrx 支持 3.1.开源驱动程序似乎在 1.3-1.4 左右达到顶峰.

Mesa software rendering is still stuck on OpenGL 2.1. If you're using the binary NVidia drivers they provide OpenGL 3.2 support on sufficiently recent hardware. AMD's latest fglrx supports 3.1. Open Source drivers seem to top out around 1.3-1.4.

如果您已经做到了这一点,您可能需要破解 Qt 源代码以使用 GLX_ARB_create_context 而不是 GLXCreateContext 来获取 OpenGL 3.2 核心上下文.

If you've gotten this far you'll probably have to hack the Qt sources to use GLX_ARB_create_context instead of GLXCreateContext to get a OpenGL 3.2 Core context.

这家伙似乎已经偏成功,如果您还没有通过 Google 遇到该线程.

This guy seems to have had partial success, if you haven't already come across the thread via Google.

这篇关于如何使用 Qt 4 创建 OpenGL 3 上下文?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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