- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在通过引用 KDAB's article part one 学习 OpenGL .这是相当新的和有帮助的。但是,我在页面上尝试他的代码时遇到编译错误。
我的Qt工程中有3个文件:main.cpp、window.cpp和window.h。
窗口.h:
#ifndef WINDOW_H
#define WINDOW_H
#include <QWindow>
#include <QSurfaceFormat>
#include <QOpenGLContext>
#include <QOpenGLFunctions_4_3_Core>
class Window : public QWindow
{
Q_OBJECT
public:
Window(QScreen* screen);
signals:
private:
QOpenGLContext *m_context;
QOpenGLFunctions_4_3_Core* m_funcs;
};
#endif // WINDOW_H
窗口.cpp:
#include "window.h"
Window::Window(QScreen* screen) :
QWindow(screen)
{
setSurfaceType(OpenGLSurface);
QSurfaceFormat format;
format.setDepthBufferSize(24);
format.setMajorVersion(4);
format.setMinorVersion(3);
format.setSamples(4);
format.setProfile(QSurfaceFormat::CoreProfile);
setFormat(format);
create();
m_context = new QOpenGLContext;
m_context->setFormat(format);
m_context->create();
// Make the context current on this window
m_context->makeCurrent( this );
// Obtain a functions object and resolve all entry points
// m_funcs is declared as: QOpenGLFunctions_4_3_Core* m_funcs
m_funcs = m_context->versionFunctions();
if ( !m_funcs ) {
qWarning( "Could not obtain OpenGL versions object" );
exit( 1 );
}
m_funcs->initializeOpenGLFunctions();
// m_funcs->glVertexAttribDivisor();
}
主要.cpp:
#include <QCoreApplication>
#include <QGLWidget>
int main(int argc, char *argv[]) {
QCoreApplication app(argc, argv);
return app.exec();
}
错误:从“QAbstractOpenGLFunctions*”到“QOpenGLFunctions_4_3_Core*”的无效转换 [-fpermissive]
最佳答案
我在Qt的文档中找到了解决方案。声明应该是
m_funcs = m_context->versionFunctions<QOpenGLFunctions_4_3_Core>();
然后错误被消除。
关于opengl - 在 Qt5.1 和 OpenGL 中从 'QAbstractOpenGLFunctions*' 到 'QOpenGLFunctions_4_3_Core*' 的无效转换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17646810/
在 wx.ComboBox 中的页面之间切换时遇到问题。错误似乎是何时更改页面两次以上。这对我来说是一个巨大的错误,我似乎无法找到解决方案。代码: import wx ok=[] class oran
我需要在 /_core/js 下的 product.js 中自定义函数的行为。函数声明为: function replaceAddToCartSections(data) {} 我尝试在 custom
我们在使用 wxPython 加载文件时遇到了问题,用例是我们将这些文件/片段放在计算机上的文件夹中。片段是原始 html 文件的一小部分 - 很多时候片段是提取的表格,表格周围包含 html 和 b
我试图在循环中获得两层之间的重叠特征。这在大多数情况下工作正常,但在某些情况下会引发异常。异常回溯甚至没有给出任何关于异常的提示。 代码: feature1_l
我正在尝试配置和运行 SVN 提交后 Hook 发送邮件。我已经下载了 mailer.py 类,为 svn 安装了 Python 2.7 和 svn-win32 绑定(bind)。机器是 Window
我在没有 jack 的 Ubuntu 14.04 上安装 pyo 并运行 Python 2.7。我遵循 Debian-based installing instructions写在 pyo wiki
我是一名优秀的程序员,十分优秀!