Skip to content

Commit

Permalink
Some final fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Cacodemon345 committed Mar 9, 2025
1 parent 7e61d2d commit e854c5b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
8 changes: 8 additions & 0 deletions src/qt/qt_glsl_parser.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
#include "qt_mainwindow.hpp"
#include <QMessageBox>
#include <QWindow>
#include <QCoreApplication>

extern MainWindow* main_window;

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
Expand Down Expand Up @@ -137,6 +144,7 @@ static glslp_t *glsl_parse(const char *f) {
strcpy(shader->shader_fn, f);
shader->shader_program = load_file(f);
if (!shader->shader_program) {
QMessageBox::critical((QWidget *) qApp->findChild<QWindow *>(), QObject::tr("GLSL error"), QObject::tr("Could not load shader %s").arg(shader->shader_fn));
//wx_simple_messagebox("GLSL error", "Could not load shader %s\n", shader->shader_fn);
glslp_free(glslp);
return 0;
Expand Down
14 changes: 9 additions & 5 deletions src/qt/qt_openglrenderer_pcem.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "qt_renderercommon.hpp"
#include "qt_mainwindow.hpp"

#include <QCoreApplication>
#include <QMessageBox>
#include <QWindow>
#include <QPainter>
Expand Down Expand Up @@ -131,6 +132,7 @@ OpenGLRendererPCem::create_program(struct shader_program *program)
glw.glGetProgramiv(program->id, GL_INFO_LOG_LENGTH, &maxLength);
char *log = (char *) malloc(maxLength);
glw.glGetProgramInfoLog(program->id, maxLength, &length, log);
QMessageBox::critical((QWidget *) qApp->findChild<QWindow *>(), tr("GLSL Error"), tr("Program not linked:\n%1").arg(log));
// wx_simple_messagebox("GLSL Error", "Program not linked:\n%s", log);
free(log);
return 0;
Expand Down Expand Up @@ -175,6 +177,7 @@ OpenGLRendererPCem::compile_shader(GLenum shader_type, const char *prepend, cons
glw.glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &length);
char *log = (char *) malloc(length);
glw.glGetShaderInfoLog(shader, length, &length, log);
QMessageBox::critical((QWidget *) qApp->findChild<QWindow *>(), tr("GLSL Error"), tr("Could not compile shader:\n%1").arg(log));
// wx_simple_messagebox("GLSL Error", "Could not compile shader:\n%s", log);

pclog("Could not compile shader: %s\n", log);
Expand Down Expand Up @@ -577,7 +580,7 @@ OpenGLRendererPCem::load_glslp(glsl_t *glsl, int num_shader, const char *f)
pclog("Load texture %s...\n", file);

if (!load_texture(file, &tex->texture)) {
// wx_simple_messagebox("GLSL Error", "Could not load texture: %s", file);
QMessageBox::critical((QWidget *) qApp->findChild<QWindow *>(), tr("GLSL Error"), tr("Could not load texture: %s").arg(file));
pclog("Could not load texture %s!\n", file);
failed = 1;
break;
Expand Down Expand Up @@ -623,6 +626,7 @@ OpenGLRendererPCem::load_glslp(glsl_t *glsl, int num_shader, const char *f)
pclog("Creating pass %u (%s)\n", (i + 1), pass->alias);
pclog("Loading shader %s...\n", shader->shader_fn);
if (!shader->shader_program) {
QMessageBox::critical((QWidget *) qApp->findChild<QWindow *>(), tr("GLSL Error"), tr("Could not load shader: %1").arg(shader->shader_fn));
// wx_simple_messagebox("GLSL Error", "Could not load shader: %s", shader->shader_fn);
pclog("Could not load shader %s\n", shader->shader_fn);
failed = 1;
Expand Down Expand Up @@ -1337,10 +1341,10 @@ OpenGLRendererPCem::render()
struct {
uint32_t x, y, w, h;
} rect, video_rect;
rect.x = destination.x();
rect.y = destination.y();
rect.w = destination.width();
rect.h = destination.height();
rect.x = 0;
rect.y = 0;
rect.w = source.width();
rect.h = source.height();

video_rect.x = source.x();
video_rect.y = source.y();
Expand Down

0 comments on commit e854c5b

Please sign in to comment.