diff --git a/test/frag.glsl b/test/frag.glsl new file mode 100644 index 0000000..34d1f54 --- /dev/null +++ b/test/frag.glsl @@ -0,0 +1,4 @@ +void main(void) +{ + gl_FragColor = vec4(0.5, 0.1, 0.9, 1.0); +} diff --git a/test/test.cpp b/test/test.cpp index 39c196c..e54c1ba 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -17,6 +17,9 @@ bool init(void) glClearColor (0.0, 0.0, 0.0, 0.0); try { + vs = make_shared(); + fs = make_shared(); + program = make_shared(); vs->create_from_file(GL_VERTEX_SHADER, "test/vert.glsl"); fs->create_from_file(GL_FRAGMENT_SHADER, "test/frag.glsl"); program->create(vs, fs); @@ -58,7 +61,13 @@ int main(int argc, char *argv[]) return 2; } - SDL_GL_CreateContext(window); + SDL_GLContext gl_context = SDL_GL_CreateContext(window); + if (gl_context == NULL) + { + cerr << "Failed to create OpenGL context" << endl; + return 1; + } + SDL_GL_MakeCurrent(window, gl_context); if (gl3wInit()) { diff --git a/test/vert.glsl b/test/vert.glsl new file mode 100644 index 0000000..13ad52e --- /dev/null +++ b/test/vert.glsl @@ -0,0 +1,6 @@ +attribute vec2 position; + +void main(void) +{ + gl_Position = vec4(position, 0, 1); +}