Start of windowed OpenGL rendering

This commit is contained in:
Cacodemon345
2021-12-17 12:17:54 +06:00
parent f0233bbede
commit 30376341d1
3 changed files with 20 additions and 11 deletions

View File

@@ -17,6 +17,12 @@ void HardwareRenderer::initializeGL()
}
void HardwareRenderer::paintGL() {
//onPaint(this);
}
void HardwareRenderer::paintUnderGL() {
glClearColor(0.f, 0.f, 0.f, 1.f);
glClear(GL_COLOR_BUFFER_BIT);
onPaint(this);
}
@@ -24,11 +30,9 @@ void HardwareRenderer::setRenderType(RenderType type) {
QSurfaceFormat format;
switch (type) {
case RenderType::OpenGL:
setTextureFormat(GL_RGB);
format.setRenderableType(QSurfaceFormat::OpenGL);
break;
case RenderType::OpenGLES:
setTextureFormat((QApplication::platformName().contains("wayland") || QApplication::platformName() == "cocoa") ? GL_RGB : GL_RGBA);
format.setRenderableType(QSurfaceFormat::OpenGLES);
break;
}
@@ -45,5 +49,5 @@ void HardwareRenderer::onBlit(const QImage& img, int x, int y, int w, int h, std
void HardwareRenderer::resizeEvent(QResizeEvent *event) {
onResize(width(), height());
QOpenGLWidget::resizeEvent(event);
QOpenGLWindow::resizeEvent(event);
}