From fa636f782579bbf746ea97925ad5e53bbd577165 Mon Sep 17 00:00:00 2001 From: lewa_j Date: Thu, 8 Aug 2019 21:54:51 +0300 Subject: [PATCH] Fix shader class compatibility with vbsp project. Update Readme --- README.md | 16 ++++++++-------- src/graphics/glsl_prog.cpp | 7 +++++-- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index a0a2ffc..95019fa 100644 --- a/README.md +++ b/README.md @@ -6,17 +6,16 @@ I put it here so as not to lose by accident. Writen in C++. Uses OpenGL/ES 2. +Use '-help' for comand line arguments. + ## Dependencies -MinGW-W64 +* [MinGW-W64](https://mingw-w64.org) +* [GLFW 3.3](https://www.glfw.org/) +* [GLM 0.9.9.0](https://glm.g-truc.net/0.9.9/index.html) +* [GLEW 2.0](http://glew.sourceforge.net/) -GLFW 3.3 - -GLM 0.9.9.0 - -GLEW 2.0 - -## demos +## Demos **StarFleet** - space battles "game". With basic fighter AI, but withous gameplay @@ -38,3 +37,4 @@ GLEW 2.0 **ComprTex** - demonstrates some compressed texture formats +**[vbsp-gles](https://github.com/lewa-j/vbsp-gles)** - vbsp maps loader and renderer \ No newline at end of file diff --git a/src/graphics/glsl_prog.cpp b/src/graphics/glsl_prog.cpp index 5d840a9..bf135b7 100644 --- a/src/graphics/glsl_prog.cpp +++ b/src/graphics/glsl_prog.cpp @@ -124,8 +124,11 @@ void glslProg::print_log(GLuint object) GLuint glslProg::CreateShader(const char *src, GLint type, const char *flags) { GLuint sid = glCreateShader(type); - const char *strings[]={flags,src}; - glShaderSource(sid,2,strings,NULL); + char ver[] = "#version 100\n"; + if(strstr(src,"#version")) + ver[0] = 0; + const char *strings[] = {ver,flags,src}; + glShaderSource(sid,3,strings,NULL); glCompileShader(sid); GLint compile_ok = GL_FALSE; glGetShaderiv(sid,GL_COMPILE_STATUS, &compile_ok);