Skip to content

Commit e854c5b

Browse files
committed
Some final fixes
1 parent 7e61d2d commit e854c5b

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

src/qt/qt_glsl_parser.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
#include "qt_mainwindow.hpp"
2+
#include <QMessageBox>
3+
#include <QWindow>
4+
#include <QCoreApplication>
5+
6+
extern MainWindow* main_window;
7+
18
#include <stdlib.h>
29
#include <stdio.h>
310
#include <string.h>
@@ -137,6 +144,7 @@ static glslp_t *glsl_parse(const char *f) {
137144
strcpy(shader->shader_fn, f);
138145
shader->shader_program = load_file(f);
139146
if (!shader->shader_program) {
147+
QMessageBox::critical((QWidget *) qApp->findChild<QWindow *>(), QObject::tr("GLSL error"), QObject::tr("Could not load shader %s").arg(shader->shader_fn));
140148
//wx_simple_messagebox("GLSL error", "Could not load shader %s\n", shader->shader_fn);
141149
glslp_free(glslp);
142150
return 0;

src/qt/qt_openglrenderer_pcem.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "qt_renderercommon.hpp"
22
#include "qt_mainwindow.hpp"
33

4+
#include <QCoreApplication>
45
#include <QMessageBox>
56
#include <QWindow>
67
#include <QPainter>
@@ -131,6 +132,7 @@ OpenGLRendererPCem::create_program(struct shader_program *program)
131132
glw.glGetProgramiv(program->id, GL_INFO_LOG_LENGTH, &maxLength);
132133
char *log = (char *) malloc(maxLength);
133134
glw.glGetProgramInfoLog(program->id, maxLength, &length, log);
135+
QMessageBox::critical((QWidget *) qApp->findChild<QWindow *>(), tr("GLSL Error"), tr("Program not linked:\n%1").arg(log));
134136
// wx_simple_messagebox("GLSL Error", "Program not linked:\n%s", log);
135137
free(log);
136138
return 0;
@@ -175,6 +177,7 @@ OpenGLRendererPCem::compile_shader(GLenum shader_type, const char *prepend, cons
175177
glw.glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &length);
176178
char *log = (char *) malloc(length);
177179
glw.glGetShaderInfoLog(shader, length, &length, log);
180+
QMessageBox::critical((QWidget *) qApp->findChild<QWindow *>(), tr("GLSL Error"), tr("Could not compile shader:\n%1").arg(log));
178181
// wx_simple_messagebox("GLSL Error", "Could not compile shader:\n%s", log);
179182

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

579582
if (!load_texture(file, &tex->texture)) {
580-
// wx_simple_messagebox("GLSL Error", "Could not load texture: %s", file);
583+
QMessageBox::critical((QWidget *) qApp->findChild<QWindow *>(), tr("GLSL Error"), tr("Could not load texture: %s").arg(file));
581584
pclog("Could not load texture %s!\n", file);
582585
failed = 1;
583586
break;
@@ -623,6 +626,7 @@ OpenGLRendererPCem::load_glslp(glsl_t *glsl, int num_shader, const char *f)
623626
pclog("Creating pass %u (%s)\n", (i + 1), pass->alias);
624627
pclog("Loading shader %s...\n", shader->shader_fn);
625628
if (!shader->shader_program) {
629+
QMessageBox::critical((QWidget *) qApp->findChild<QWindow *>(), tr("GLSL Error"), tr("Could not load shader: %1").arg(shader->shader_fn));
626630
// wx_simple_messagebox("GLSL Error", "Could not load shader: %s", shader->shader_fn);
627631
pclog("Could not load shader %s\n", shader->shader_fn);
628632
failed = 1;
@@ -1337,10 +1341,10 @@ OpenGLRendererPCem::render()
13371341
struct {
13381342
uint32_t x, y, w, h;
13391343
} rect, video_rect;
1340-
rect.x = destination.x();
1341-
rect.y = destination.y();
1342-
rect.w = destination.width();
1343-
rect.h = destination.height();
1344+
rect.x = 0;
1345+
rect.y = 0;
1346+
rect.w = source.width();
1347+
rect.h = source.height();
13441348

13451349
video_rect.x = source.x();
13461350
video_rect.y = source.y();

0 commit comments

Comments
 (0)