diff --git a/src/dlangui/graphics/glsupport.d b/src/dlangui/graphics/glsupport.d index ad3fc543..d5f896c4 100644 --- a/src/dlangui/graphics/glsupport.d +++ b/src/dlangui/graphics/glsupport.d @@ -84,10 +84,17 @@ class GLProgram { import core.stdc.stdlib; import std.string; - Log.d("compileShader glsl=", glslversion, " code: ", src); + char[] versionLine; + versionLine ~= "#version "; + foreach(ch; glslversion) + if (ch >= '0' && ch <= '9') + versionLine ~= ch; + versionLine ~= "\n\n"; + string sourceCode = versionLine ~ src; + Log.d("compileShader glsl=", glslversion, " code: ", sourceCode); GLuint shader = glCreateShader(type);//GL_VERTEX_SHADER - const char * psrc = src.toStringz; + const char * psrc = sourceCode.toStringz; GLuint len = cast(uint)src.length; glShaderSource(shader, 1, &psrc, cast(const(int)*)&len); glCompileShader(shader); diff --git a/src/dlangui/platforms/sdl/sdlapp.d b/src/dlangui/platforms/sdl/sdlapp.d index 3ec78bed..1714c5d3 100644 --- a/src/dlangui/platforms/sdl/sdlapp.d +++ b/src/dlangui/platforms/sdl/sdlapp.d @@ -147,23 +147,9 @@ class SDLWindow : Window { Log.i("Trying to create OpenGL 3.2 context"); _context = SDL_GL_CreateContext(_win); // Create the actual context and make it current if (!_context) { - Log.e("SDL_GL_CreateContext failed for version 3.2: ", fromStringz(SDL_GetError())); - Log.w("Trying to create OpenGL 2.1 context"); - SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION,2); - SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION,1); - _context = SDL_GL_CreateContext(_win); // Create the actual context and make it current - if (!_context) { - Log.e("SDL_GL_CreateContext failed: ", fromStringz(SDL_GetError())); - Log.w("Trying to create OpenGL 2.0 context"); - SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION,2); - SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION,0); - _context = SDL_GL_CreateContext(_win); // Create the actual context and make it current - if (!_context) { - Log.e("SDL_GL_CreateContext failed: ", fromStringz(SDL_GetError())); - _enableOpengl = false; - Log.w("OpenGL support is disabled"); - } - } + Log.e("SDL_GL_CreateContext failed: ", fromStringz(SDL_GetError())); + _enableOpengl = false; + Log.w("OpenGL support is disabled"); } if (_context && !_gl3Reloaded) { DerelictGL3.reload();