- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我的基于 QT 5.8 的代码无法在某些 Windows 机器上运行任何 OpenGl 命令。似乎找不到正确的渲染 API。
这是终端日志的相对部分。
qt.qpa.gl: QWindowsIntegration::createPlatformOpenGLContext QSurfaceFormat(version 2.0, options QFlagsQSurfaceFormat::FormatOption(), depthBufferSize -1, redBufferSize -1, greenBufferSize -1, blueBufferSize -1, alphaBufferSize -1, stencilBufferSize -1, samples -1, swapBehavior QSurfaceFormat::SwapBehavior(DefaultSwapBehavior), swapInterval 1, profile QSurfaceFormat::OpenGLContextProfile(NoProfile))
qt.qpa.gl: Basic wglCreateContext gives version 3.1
qt.qpa.gl: OpenGL 2.0 entry points available
qt.qpa.gl: GPU features: QSet("disable_desktopgl")
qt.qpa.gl: Disabling Desktop GL: GpuDescription(vendorId=0x8086, deviceId=0x102, subSysId=0x2abf103c, revision=9, driver: "igdumd64.dll", version=9.17.10.4459, "Intel(R) HD Graphics")
qt.qpa.gl: QWindowsOpenGLTester::supportedRenderers GpuDescription(vendorId=0x8086, deviceId=0x102, subSysId=0x2abf103c, revision=9, driver: "igdumd64.dll", version=9.17.10.4459, "Intel(R) HD Graphics") renderer: QFlags(0x2|0x4|0x8|0x20)
qt.qpa.gl: Qt: Using EGL from libEGL
qt.qpa.gl: Qt: Using OpenGL ES 2.0 from libGLESv2
qt.qpa.gl: QWindowsEGLStaticContext::create Created EGL display 0x231e2bdc450 v 1 . 4
qt.qpa.gl: QWindowsIntegration::createPlatformOpenGLContext QSurfaceFormat(version 2.0, options QFlagsQSurfaceFormat::FormatOption(), depthBufferSize -1, redBufferSize -1, greenBufferSize -1, blueBufferSize -1, alphaBufferSize -1, stencilBufferSize -1, samples 0, swapBehavior QSurfaceFormat::SwapBehavior(DefaultSwapBehavior), swapInterval 1, profile QSurfaceFormat::OpenGLContextProfile(NoProfile))
qt.qpa.windows: QWindowsContext::registerWindowClass "Qt5QWindowOwnDCIcon" style=0x28 brush=0x1100060 icon=true atom=49819
qt.qpa.windows: QWindowsGeometryHint::frame style=0x86cf0000 exStyle=0x0 RECT: left/top=-8,-31 right/bottom=8,8 QMargins(8, 31, 8, 8)
qt.qpa.windows: QWindowCreationContext::QWindowCreationContext QWindow(0x231e53f99d0, name="QOffscreenSurface") QRect(0,0 1x1) pos incl. frame=false frame=17x40+0+0 min=QSize(0, 0) max=QSize(16777215, 16777215) custom margins=QMargins(0, 0, 0, 0)
qt.qpa.windows: CreateWindowEx: QWindow(0x231e53f99d0, name="QOffscreenSurface") class="Qt5QWindowOwnDCIcon" title="MVM_UserInterface"
WindowCreationData: QFlagsQt::WindowType(Window|WindowTitleHint|WindowSystemMenuHint|WindowMinMaxButtonsHint|WindowCloseButtonHint)
topLevel=true popup=false dialog=false embedded=false tool=false
style=0x86cf0000 WS_POPUP WS_CLIPSIBLINGS WS_CLIPCHILDREN WS_THICKFRAME WS_DLGFRAME WS_SYSMENU WS_MINIMIZEBOX WS_MAXIMIZEBOX
requested: QRect(0,0 1x1): 17x40+0+0 custom margins: QMargins(0, 0, 0, 0)
qt.qpa.windows: >QWindowsGeometryHint::applyToMinMaxInfo< min=0,0 max=16777215,16777215 in MINMAXINFO maxSize=1696,1066 maxpos=-8,-8 mintrack=136,39 maxtrack=1700,1070
qt.qpa.windows: QWindowsGeometryHint::frame style=0x86cf0000 exStyle=0x0 RECT: left/top=-8,-31 right/bottom=8,8 QMargins(8, 31, 8, 8)
qt.qpa.windows: <QWindowsGeometryHint::applyToMinMaxInfo frame=QMargins(8, 31, 8, 8) 16,39 out MINMAXINFO maxSize=1696,1066 maxpos=-8,-8 mintrack=136,39 maxtrack=1700,1070
qt.qpa.windows: CreateWindowEx: returns QWindow(0x231e53f99d0, name="QOffscreenSurface") 0x40c28 obtained geometry: QRect(8,31 120x1) QMargins(8, 31, 8, 8)
qt.qpa.windows: QWindowsIntegration::createPlatformWindow QWindow(0x231e53f99d0, name="QOffscreenSurface")
Requested: QRect(0,0 1x1) frame incl.=false QFlagsQt::WindowType(Window)
Obtained : QRect(8,31 120x1) margins=QMargins(8, 31, 8, 8) handle=0x40c28 QFlagsQt::WindowType(Window|WindowTitleHint|WindowSystemMenuHint|WindowMinMaxButtonsHint|WindowCloseButtonHint)
qt.qpa.mime: QWindowsWindow::setDropSiteEnabled QWindow(0x231e53f99d0, name="QOffscreenSurface") true
qt.qpa.mime: QWindowsOleDropTarget::QWindowsOleDropTarget 0x231e8043430 QWindow(0x231e53f99d0, name="QOffscreenSurface")
OpenGL error 00000502 - GL_INVALID_OPERATION, at C:\Projects\CodeFactory\Src\Apps\MVM_UserInterface\QtGui\MainGlWidget.cpp:88 - for glEnable(GL_DEPTH_TEST)
OpenGL error 00000502 - GL_INVALID_OPERATION, at C:\Projects\CodeFactory\Src\Apps\MVM_UserInterface\QtGui\MainGlWidget.cpp:89 - for glEnable(GL_CULL_FACE)
OpenGL error 00000502 - GL_INVALID_OPERATION, at C:\Projects\CodeFactory\Src\Apps\MVM_UserInterface\QtGui\MainGlWidget.cpp:93 - for glShadeModel(GL_SMOOTH)
OpenGL error 00000502 - GL_INVALID_OPERATION, at C:\Projects\CodeFactory\Src\Apps\MVM_UserInterface\QtGui\MainGlWidget.cpp:94 - for glEnable(GL_LIGHTING)
OpenGL error 00000502 - GL_INVALID_OPERATION, at C:\Projects\CodeFactory\Src\Apps\MVM_UserInterface\QtGui\MainGlWidget.cpp:95 - for glEnable(GL_LIGHT0)
OpenGL error 00000502 - GL_INVALID_OPERATION, at C:\Projects\CodeFactory\Src\Apps\MVM_UserInterface\QtGui\MainGlWidget.cpp:96 - for glClearColor(0.4, 0.4, 0.4, 1)
OpenGL error 00000502 - GL_INVALID_OPERATION, at C:\Projects\CodeFactory\Src\Apps\MVM_UserInterface\QtGui\MainGlWidget.cpp:97 - for glEnable(GL_BLEND)
OpenGL error 00000502 - GL_INVALID_OPERATION, at C:\Projects\CodeFactory\Src\Apps\MVM_UserInterface\QtGui\MainGlWidget.cpp:98 - for glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
OpenGL error 00000502 - GL_INVALID_OPERATION, at C:\Projects\CodeFactory\Src\Apps\MVM_UserInterface\QtGui\MainGlWidget.cpp:99 - for glDepthMask(GL_TRUE)
failed to compile shader: Phong/Phong.frag
ERROR: 0:2: '' : No precision specified for (float)
// MainGlWidget.cpp
#include <QtWidgets>
#include <QtOpenGL>
#include "MainGlWidget.h"
#include "iostream"
#include "Common.h"
#ifdef __APPLE__
#include <unistd.h>
#endif //
/*#include "Common.h"
#include "UltimateDesign.h"*/
MainGlWidget::MainGlWidget(QWidget *parent)
: QOpenGLWidget(parent)
{
xRot = 0;
yRot = 0;
zRot = 0;
}
MainGlWidget::~MainGlWidget()
{
}
QSize MainGlWidget::minimumSizeHint() const
{
return QSize(50, 50);
}
QSize MainGlWidget::sizeHint() const
{
return QSize(400, 400);
}
static void qNormalizeAngle(int &angle)
{
while (angle < 0)
angle += 360 * 16;
while (angle > 360)
angle -= 360 * 16;
}
void MainGlWidget::setXRotation(int angle)
{
qNormalizeAngle(angle);
if (angle != xRot) {
xRot = angle;
emit xRotationChanged(angle);
}
}
void MainGlWidget::setYRotation(int angle)
{
qNormalizeAngle(angle);
if (angle != yRot) {
yRot = angle;
emit yRotationChanged(angle);
}
}
void MainGlWidget::setZRotation(int angle)
{
qNormalizeAngle(angle);
if (angle != zRot) {
zRot = angle;
emit zRotationChanged(angle);
}
}
void MainGlWidget::importFile(std::string file)
{
makeCurrent();
application->importFile(file);
doneCurrent();
}
void MainGlWidget::initializeGL()
{
CHECK_GL(glEnable(GL_DEPTH_TEST));
CHECK_GL(glEnable(GL_CULL_FACE));
//CHECK_GL(glCullFace(GL_CULL_FACE));
//glCullFace(GL_BACK);
CHECK_GL(glShadeModel(GL_SMOOTH));
CHECK_GL(glEnable(GL_LIGHTING));
CHECK_GL(glEnable(GL_LIGHT0));
CHECK_GL(glClearColor(0.4, 0.4, 0.4, 1));
CHECK_GL(glEnable(GL_BLEND));
CHECK_GL(glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA));
CHECK_GL(glDepthMask(GL_TRUE));
#ifdef WIN32
//glViewport(0, 0, 1280, 960);
#endif
application->init((QOpenGLWidget*)this);
application->setScreenDimentions(width(),height());
#ifdef WIN32
CreateThread(
NULL, // default security attributes
0, // use default stack size
timer, // thread function name
(void*) this, // argument to thread function
0, // use default creation flags
NULL); // returns the thread identifier
#elif __linux__ || __APPLE__
pthread_t thread;
pthread_create(&thread, NULL, timer, (void*) this);
#endif
}
void MainGlWidget::paintGL()
{
GLint m_viewport[4];
glGetIntegerv( GL_VIEWPORT, m_viewport );
CHECK_GL(glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT));
//std::cout<<"paint "<<pthread_self();
application->render("cam1");
//((Geo::Cube*)scene->get("cube2"))->draw();
}
void MainGlWidget::resizeGL(int width, int height)
{
std::cout << "width" << width << std::endl;
std::cout << "height" << height << std::endl;
size[0] = width;
size[1] = height;
#ifndef DRONE
int side = qMin(size[0], size[1]);
glViewport((size[0]-side)/2,(size[1]-side)/2, side, side);
#endif
update();
}
void MainGlWidget::mousePressEvent(QMouseEvent *event)
{
lastPos = event->pos();
if (event->buttons() & Qt::LeftButton) {
application->mouseClickWithLeft(lastPos.x(),lastPos.y());
}else if (event->buttons() & Qt::RightButton) {
application->mouseClickWithRight(lastPos.x(),lastPos.y());
}
//std::cout<<"clicked point 2D x,y"<<lastPos.x()<<","<<lastPos.y()<<std::endl;
}
void MainGlWidget::mouseMoveEvent(QMouseEvent *event)
{
int dx = event->x() - lastPos.x();
int dy = event->y() - lastPos.y();
lastPos = event->pos();
if (event->buttons() & Qt::LeftButton) {
setXRotation(xRot + dy);
setYRotation(yRot + dx);
application->mouseDragWithLeft(dx,dy);
} else if (event->buttons() & Qt::RightButton) {
setXRotation(xRot + 8 * dy);
setZRotation(zRot + 8 * dx);
application->mouseDragWithRight(dx,dy);
}else if (event->buttons() &Qt::MiddleButton) {
setXRotation(xRot + 8 * dy);
setZRotation(zRot + 8 * dx);
application->mouseDragWithMiddle(dx,dy);
}
// float rot[] = { xRot, 0, 0 };
// float transc[] = { 0, 0, 1 };
// scene->getCamera("cam1")->setTransformation(transc, rot);
// scene->updated=true;
// scene->callViews();
}
void MainGlWidget::draw()
{
}
#ifdef WIN32
DWORD WINAPI timer(LPVOID lpParam)
{
MainGlWidget* glwidget = (MainGlWidget*)lpParam;
while (true)
{
glwidget->update();
Sleep(10);
}
}
#elif __linux__ || __APPLE__
void *timer(void *lpParam)
{
MainGlWidget* glwidget = (MainGlWidget*)lpParam;
while (true)
{
glwidget->update();
usleep(16000);
}
}
#endif
最佳答案
看看这行:
qt.qpa.gl: GPU features: QSet("disable_desktopgl")
qt.qpa.gl: Disabling Desktop GL: GpuDescription(vendorId=0x8086,deviceId=0x102, subSysId=0x2abf103c, revision=9, driver:"igdumd64.dll", version=9.17.10.4459, "Intel(R) HD Graphics")
QApplication::setAttribute( Qt::AA_UseDesktopOpenGL );
它应该在创建 QApplication 之前设置。
关于c++ - QT 找不到要使用的正确 OpenGL api,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43468522/
例如,我有一个父类Author: class Author { String name static hasMany = [ fiction: Book,
代码如下: dojo.query(subNav.navClass).forEach(function(node, index, arr){ if(dojo.style(node, 'd
我有一个带有 Id 和姓名的学生表和一个带有 Id 和 friend Id 的 Friends 表。我想加入这两个表并找到学生的 friend 。 例如,Ashley 的 friend 是 Saman
我通过互联网浏览,但仍未找到问题的答案。应该很容易: class Parent { String name Child child } 当我有一个 child 对象时,如何获得它的 paren
我正在尝试创建一个以 Firebase 作为我的后端的社交应用。现在我正面临如何(在哪里?)找到 friend 功能的问题。 我有每个用户的邮件地址。 我可以访问用户的电话也预订。 在传统的后端中,我
我主要想澄清以下几点: 1。有人告诉我,在 iOS 5 及以下版本中,如果您使用 Game Center 设置多人游戏,则“查找 Facebook 好友”(如与好友争夺战)的功能不是内置的,因此您需要
关于redis docker镜像ENTRYPOINT脚本 docker-entrypoint.sh : #!/bin/sh set -e # first arg is `-f` or `--some-
我是一名优秀的程序员,十分优秀!