Skip to content

Commit 28b9a71

Browse files
committed
Fix some more build errors
1 parent 9d1fe94 commit 28b9a71

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

src/shaderprogram.cpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,9 @@
1111
#include "shaderobject.h"
1212
#include <GL/gl.h>
1313
#include <GL/glext.h>
14-
#include <fstream>
1514
#include <iostream>
1615
#include <map>
1716
#include <memory>
18-
#include <sstream>
1917
#include <stdexcept>
2018
#include <string_view>
2119
#include <vector>
@@ -123,7 +121,7 @@ void ShaderProgram::link() {
123121
_program = 0;
124122
}
125123

126-
glCall("after created program");
124+
glCall((void)"after created program");
127125
}
128126

129127
void ShaderProgram::unlink() {

src/shaders/plainshader.h

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#pragma once
99

1010
// #include "matgui/common-gl.h"
11+
#include "../lib/sdlpp/include/sdlpp/opengl.hpp"
1112
#include "glpp/gl-backend.hpp"
1213
#include "matgui/matgui-constants.h"
1314
#include "matgui/shaderprogram.h"

src/window.cpp

+7-4
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@
77

88
#include "matgui/window.h"
99
#include "matgui/application.h"
10-
// #include "matgui/common-gl.h"
1110
#include "matgui/draw.h"
1211
#include "windowdata.h"
12+
#include <SDL2/SDL_video.h>
1313
#include <iostream>
1414

1515
#include "../lib/sdlpp/include/sdlpp/mouse.hpp"
16+
#include "../lib/sdlpp/include/sdlpp/opengl.hpp"
1617

1718
using std::cout;
1819
using std::endl;
@@ -96,11 +97,13 @@ Window::Window(string title, int width, int height, bool resizable) {
9697
checkSDLError(__LINE__);
9798

9899
// Windows needs to make the context current
99-
if (_windowData->context.makeCurrent({_windowData->window})) {
100+
101+
if (SDL_GL_MakeCurrent(_windowData->window.get(), _windowData->context)) {
100102
throw std::runtime_error("could not make SDL GL context active");
101103
}
102104

103-
cout << "Supported version of OpenGl: " << glGetString(GL_VERSION) << endl;
105+
// cout << "Supported version of OpenGl: " << glGetString(GL_VERSION) <<
106+
// endl;
104107

105108
#ifdef USING_GLEW
106109
GLenum err = glewInit();
@@ -126,7 +129,7 @@ Window::~Window() {
126129
}
127130

128131
void Window::clear() {
129-
_windowData->context.makeCurrent(sdl::WindowView{_windowData->window});
132+
SDL_GL_MakeCurrent(_windowData->window, _windowData->context);
130133
auto &color = currentStyle.fill;
131134
matgui::clear(color.r, color.g, color.b, color.a);
132135
}

src/windowdata.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
#pragma once
99

10-
#include "../lib/sdlpp/include/sdlpp/opengl.hpp"
1110
#include "../lib/sdlpp/include/sdlpp/window.hpp"
1211
#include "matgui/window.h"
1312
#include <SDL2/SDL_video.h> //For SDL_GLContext
@@ -16,7 +15,7 @@ namespace matgui {
1615

1716
struct Window::WindowData {
1817
sdl::Window window;
19-
sdl::gl::Context context;
18+
void *context;
2019
Uint32 windowId = 0;
2120
//! Invalid: The window needs redrawing (when continuous updates = false)
2221
bool invalid = true;

0 commit comments

Comments
 (0)