Derelict GL3 upgrade - fix #579

This commit is contained in:
Vadim Lopatin 2018-11-26 09:43:15 +03:00
parent 5616e06d4e
commit 60159c61e2
4 changed files with 44 additions and 34 deletions

View File

@ -48,12 +48,13 @@
"versions": ["USE_OPENGL", "EmbedStandardResources"],
"versions-posix": ["USE_SDL", "USE_FREETYPE"],
"versions-windows": ["Unicode"],
"libs-windows": ["opengl32"],
"dependencies": {
"derelict-gl3": "~>1.0.18",
"derelict-ft": "~>1.1.2"
"derelict-gl3": "~>2.0.0-beta.7",
"derelict-ft": "~>2.0.0-beta.4"
},
"dependencies-posix": {
"derelict-sdl2": "~>2.0.0"
"derelict-sdl2": "~>3.0.0-beta.7"
},
"copyFiles-windows-x86_64": [
"libs/windows/x86_64/libfreetype-6.dll"
@ -70,9 +71,10 @@
{
"name": "external",
"versions": ["USE_EXTERNAL"],
"libs-windows": ["opengl32"],
"dependencies": {
"derelict-gl3": "~>1.0.18",
"derelict-ft": "~>1.1.2"
"derelict-gl3": "~>2.0.0-beta.7",
"derelict-ft": "~>2.0.0-beta.4"
}
},
{
@ -80,10 +82,11 @@
"versions": ["EmbedStandardResources", "ForceLogs"],
"versions-posix": ["USE_SDL", "USE_FREETYPE", "NO_OPENGL"],
"versions-windows": ["Unicode" ,"NO_OPENGL"],
"libs-windows": ["opengl32"],
"dependencies-posix": {
"derelict-gl3": "~>1.0.18",
"derelict-sdl2": "~>2.0.0",
"derelict-ft": "~>1.1.2"
"derelict-gl3": "~>2.0.0-beta.7",
"derelict-sdl2": "~>3.0.0-beta.7",
"derelict-ft": "~>2.0.0-beta.4"
}
},
{
@ -91,9 +94,9 @@
"versions": ["USE_SDL", "USE_OPENGL", "USE_FREETYPE", "EmbedStandardResources"],
"versions-windows": ["Unicode"],
"dependencies": {
"derelict-gl3": "~>1.0.18",
"derelict-ft": "~>1.1.2",
"derelict-sdl2": "~>2.0.0"
"derelict-gl3": "~>2.0.0-beta.7",
"derelict-ft": "~>2.0.0-beta.4",
"derelict-sdl2": "~>3.0.0-beta.7"
},
"copyFiles-windows-x86_64": [
"libs/windows/x86_64/libfreetype-6.dll",
@ -109,8 +112,8 @@
"versions": ["USE_X11", "USE_FREETYPE", "EmbedStandardResources"],
"versions-windows": ["Unicode"],
"dependencies": {
"derelict-gl3": "~>1.0.18",
"derelict-ft": "~>1.1.2",
"derelict-gl3": "~>2.0.0-beta.7",
"derelict-ft": "~>2.0.0-beta.4",
"x11": "~>1.0.17"
}
},
@ -119,8 +122,8 @@
"versions": ["USE_DSFML", "USE_OPENGL", "USE_FREETYPE", "EmbedStandardResources"],
"versions-windows": ["Unicode"],
"dependencies": {
"derelict-gl3": "~>1.0.18",
"derelict-ft": "~>1.1.2",
"derelict-gl3": "~>2.0.0-beta.7",
"derelict-ft": "~>2.0.0-beta.4",
"dsfml": "~>2.1.0"
},
"copyFiles-windows-x86_64": [

View File

@ -1283,8 +1283,8 @@ void main()
static if (ENABLE_OPENGL) {
import derelict.opengl3.gl3;
import derelict.opengl3.gl;
import derelict.opengl; //3.gl3;
//import derelict.opengl3.gl;
class MyOpenglWidget : VerticalLayout {
this() {
@ -1362,6 +1362,7 @@ static if (ENABLE_OPENGL) {
/// Legacy API example (glBegin/glEnd)
void drawUsingOldAPI(Rect rc) {
/*
static bool _initCalled;
if (!_initCalled) {
Log.d("GlGears: calling init()");
@ -1376,6 +1377,7 @@ static if (ENABLE_OPENGL) {
glDisable(GL_LIGHTING);
glDisable(GL_LIGHT0);
glDisable(GL_DEPTH_TEST);
*/
}
/// New API example (OpenGL3+, shaders)
@ -1397,13 +1399,15 @@ static if (ENABLE_OPENGL) {
}
}
static __gshared GLfloat angle = 0.0;
version (GLLegacyAPI) {
// Sample project for old API: GlxGears
import std.math;
static __gshared GLfloat view_rotx = 20.0, view_roty = 30.0, view_rotz = 0.0;
static __gshared GLint gear1, gear2, gear3;
static __gshared GLfloat angle = 0.0;
alias M_PI = std.math.PI;
/*
@ -1417,6 +1421,7 @@ static if (ENABLE_OPENGL) {
* teeth - number of teeth
* tooth_depth - depth of tooth
*/
static void
gear(GLfloat inner_radius, GLfloat outer_radius, GLfloat width,
GLint teeth, GLfloat tooth_depth)
@ -1625,5 +1630,5 @@ static if (ENABLE_OPENGL) {
glEnable(GL_NORMALIZE);
}
}
}

View File

@ -47,10 +47,12 @@ version (Android) {
}
} else {
enum SUPPORT_LEGACY_OPENGL = true;
public import derelict.opengl3.types;
public import derelict.opengl3.gl3;
public import derelict.opengl3.gl;
enum SUPPORT_LEGACY_OPENGL = false; //true;
public import derelict.opengl;
//public import derelict.opengl.types;
//public import derelict.opengl.versions.base;
//public import derelict.opengl.versions.gl3x;
//public import derelict.opengl.gl;
derelict.util.exception.ShouldThrow gl3MissingSymFunc( string symName ) {
import std.algorithm : equal;
@ -672,7 +674,7 @@ bool initGLSupport(bool legacy = false) {
DERELICT_GL3_RELOADED = true;
try {
Log.v("Reloading DerelictGL3");
import derelict.opengl3.gl3;
import derelict.opengl; //.gl3;
DerelictGL3.missingSymbolCallback = &gl3MissingSymFunc;
DerelictGL3.reload();
gl3ReloadedOk = true;
@ -681,9 +683,9 @@ bool initGLSupport(bool legacy = false) {
}
try {
Log.v("Reloading DerelictGL");
import derelict.opengl3.gl;
DerelictGL.missingSymbolCallback = &gl3MissingSymFunc;
DerelictGL.reload();
import derelict.opengl; //.gl;
DerelictGL3.missingSymbolCallback = &gl3MissingSymFunc;
DerelictGL3.reload();
glReloadedOk = true;
} catch (Exception e) {
Log.e("Derelict exception while reloading DerelictGL", e);
@ -749,7 +751,7 @@ final class GLSupport {
version (Android) {
Log.d("creating GLSupport");
} else {
if (legacy && !glLightfv) {
if (legacy /*&& !glLightfv*/) {
Log.w("GLSupport legacy API is not supported");
legacy = false;
}

View File

@ -160,7 +160,7 @@ static if (ENABLE_OPENGL) {
/// Shared opengl context helper
struct SharedGLContext {
import derelict.opengl3.wgl;
import derelict.opengl; //3.wgl;
HGLRC _hGLRC; // opengl context
HPALETTE _hPalette;
@ -323,8 +323,8 @@ class Win32Window : Window {
EndPaint(_hwnd, &ps);
import derelict.opengl3.gl3;
import derelict.opengl3.wgl;
import derelict.opengl; //3.gl3;
import derelict.opengl; //3.wgl;
import dlangui.graphics.gldrawbuf;
//Log.d("onPaint() start drawing opengl viewport: ", _dx, "x", _dy);
//PAINTSTRUCT ps;
@ -1309,13 +1309,13 @@ string[] splitCmdLine(string line) {
private __gshared Win32Platform w32platform;
static if (ENABLE_OPENGL) {
import derelict.opengl3.gl3;
import derelict.opengl3.gl;
import derelict.opengl; //3.gl3;
//import derelict.opengl3.gl;
void initOpenGL() {
try {
Log.d("Loading Derelict GL");
DerelictGL.load();
//DerelictGL.load();
DerelictGL3.load();
Log.d("Derelict GL - loaded");
//