mirror of https://github.com/buggins/dlangui.git
trying to fix OpenGL problem on MAC
This commit is contained in:
parent
057a37df3e
commit
945aabfc1d
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue