Полноэкранные тесты glmark2 дают 150+ FPS без ошибок
Код: Выделить всё
~ glmark2-es2-wayland --fullscreen
=======================================================
glmark2 2023.01
=======================================================
OpenGL Information
GL_VENDOR: Imagination Technologies
GL_RENDERER: PowerVR B-Series BXE-2-32
GL_VERSION: OpenGL ES 3.2 build 23.2@6460340
Surface Config: buf=32 r=8 g=8 b=8 a=8 depth=24 stencil=8 samples=0
Surface Size: 1920x1080 fullscreen
=======================================================
[build] use-vbo=false: FPS: 159 FrameTime: 6.320 ms
[build] use-vbo=true: FPS: 229 FrameTime: 4.385 ms
[texture] texture-filter=nearest: FPS: 223 FrameTime: 4.496 ms
[texture] texture-filter=linear: FPS: 221 FrameTime: 4.530 ms
[texture] texture-filter=mipmap: FPS: 219 FrameTime: 4.568 ms
[shading] shading=gouraud: FPS: 195 FrameTime: 5.148 ms
[shading] shading=blinn-phong-inf: FPS: 189 FrameTime: 5.312 ms
[shading] shading=phong: FPS: 147 FrameTime: 6.820 ms
[shading] shading=cel: FPS: 132 FrameTime: 7.603 ms
[bump] bump-render=high-poly: FPS: 135 FrameTime: 7.432 ms
[bump] bump-render=normals: FPS: 215 FrameTime: 4.666 ms
[bump] bump-render=height: FPS: 202 FrameTime: 4.970 ms
...
main.cpp
Код: Выделить всё
#include "mainwindow.h"
#include "openglwidget.h"
#include
#include
static QSurfaceFormat createFormat(){
QSurfaceFormat format;
// Инициализация OpenGL ES
format.setRenderableType(QSurfaceFormat::OpenGLES);
// format.setProfile(QSurfaceFormat::CoreProfile);
// format.setVersion(3,0);
format.setDepthBufferSize(0);
format.setStencilBufferSize(0);
format.setSamples(0);
format.setSwapBehavior(QSurfaceFormat::DoubleBuffer);
format.setSwapInterval(0);
return format;
}
int main(int argc, char *argv[])
{
QSurfaceFormat format = createFormat();
QSurfaceFormat::setDefaultFormat(format);
QApplication a(argc, argv);
MainWindow w; // default window
OpenGLWidget* widget = new OpenGLWidget;
w.setCentralWidget(widget);
// w.show();
w.showFullScreen();
return a.exec();
}
Код: Выделить всё
void OpenGLWidget::initializeGL()
{
initializeOpenGLFunctions();
glDisable(GL_DEPTH_TEST);
glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
// init Shader Program
program = new QOpenGLShaderProgram(this);
program->addShaderFromSourceFile(QOpenGLShader::Vertex, ":/shaders/vertex.glsl");
program->addShaderFromSourceFile(QOpenGLShader::Fragment, ":/shaders/fragment.glsl");
program->link();
float k_a = 0.05f;
// Triangle vert
GLfloat vertices[] = {
0.000f, 1.0f * k_a, // Верхняя точка
-0.005f, 0.0f, // Левая точка
0.005f, 0.0f // Правая точка
};
// VAO
vao = new QOpenGLVertexArrayObject(this);
vao->create();
vao->bind();
// VBO
vbo = new QOpenGLBuffer(QOpenGLBuffer::VertexBuffer);
vbo->create();
vbo->bind();
vbo->allocate(vertices, sizeof(vertices));
// VAO->Program
program->setAttributeBuffer("aPos", GL_FLOAT, 0, 2, sizeof(GLfloat) * 2);
program->enableAttributeArray("aPos");
vao->release();
// Update timer
timer = new QTimer(this);
connect(timer, &QTimer::timeout, this, qOverload(&OpenGLWidget::update));
timer->start(1);
time.start();
}
void OpenGLWidget::paintGL()
{
glClear(GL_COLOR_BUFFER_BIT);
program->bind();
for (int i = -100; i setUniformValue("model", modelMatrix);
vao->bind();
glDrawArrays(GL_TRIANGLES, 0, 3);
vao->release();
}
program->release();
angle += 1.0f;
frameCount++;
double currentTime = time.elapsed() / 1000.0;
if (currentTime - lastTime >= 1.0) {
fps = (double)frameCount / (currentTime - lastTime);
qDebug()
Подробнее здесь: [url]https://stackoverflow.com/questions/79193757/qt6-opengl-es-low-fps-optimization-for-bananapi-bpi-f3[/url]