mirror of https://github.com/buggins/dlangui.git
configuration definitions rework
This commit is contained in:
parent
d11f9428cc
commit
55c4b077da
|
@ -1,35 +1,89 @@
|
|||
module dlangui.core.config;
|
||||
|
||||
version (Windows) {
|
||||
// force Unicode definition under Windows
|
||||
version = Unicode;
|
||||
version (USE_FREETYPE) {
|
||||
immutable bool USE_FREETYPE = true;
|
||||
} else {
|
||||
version = USE_FREETYPE;
|
||||
version (Windows) {
|
||||
immutable bool ENABLE_FREETYPE = false;
|
||||
} else {
|
||||
immutable bool ENABLE_FREETYPE = true;
|
||||
}
|
||||
}
|
||||
|
||||
// provide default configuratino definitions
|
||||
version (USE_SDL) {
|
||||
// SDL backend already selected
|
||||
// SDL backend already selected using version identifier
|
||||
version (USE_OPENGL) {
|
||||
immutable bool ENABLE_OPENGL = true;
|
||||
} else {
|
||||
immutable bool ENABLE_OPENGL = false;
|
||||
}
|
||||
immutable bool BACKEND_SDL = true;
|
||||
immutable bool BACKEND_X11 = false;
|
||||
immutable bool BACKEND_DSFML = false;
|
||||
immutable bool BACKEND_WIN32 = false;
|
||||
} else version (USE_X11) {
|
||||
// X11 backend already selected
|
||||
// X11 backend already selected using version identifier
|
||||
version (USE_OPENGL) {
|
||||
immutable bool ENABLE_OPENGL = true;
|
||||
} else {
|
||||
immutable bool ENABLE_OPENGL = false;
|
||||
}
|
||||
immutable bool BACKEND_SDL = false;
|
||||
immutable bool BACKEND_X11 = true;
|
||||
immutable bool BACKEND_DSFML = false;
|
||||
immutable bool BACKEND_WIN32 = false;
|
||||
} else version (USE_WIN32) {
|
||||
// Win32 backend already selected using version identifier
|
||||
version (USE_OPENGL) {
|
||||
immutable bool ENABLE_OPENGL = true;
|
||||
} else {
|
||||
immutable bool ENABLE_OPENGL = false;
|
||||
}
|
||||
immutable bool BACKEND_SDL = false;
|
||||
immutable bool BACKEND_X11 = false;
|
||||
immutable bool BACKEND_DSFML = false;
|
||||
immutable bool BACKEND_WIN32 = true;
|
||||
} else version (USE_DSFML) {
|
||||
// DSFML backend already selected
|
||||
// DSFML backend already selected using version identifier
|
||||
version (USE_OPENGL) {
|
||||
immutable bool ENABLE_OPENGL = true;
|
||||
} else {
|
||||
immutable bool ENABLE_OPENGL = false;
|
||||
}
|
||||
immutable bool BACKEND_SDL = false;
|
||||
immutable bool BACKEND_X11 = false;
|
||||
immutable bool BACKEND_DSFML = true;
|
||||
immutable bool BACKEND_WIN32 = false;
|
||||
} else {
|
||||
// no backend selected: set default based on platform
|
||||
version (Windows) {
|
||||
// For Windows
|
||||
// by default: no freetype
|
||||
version = USE_OPENGL;
|
||||
immutable bool ENABLE_OPENGL = true;
|
||||
immutable bool BACKEND_SDL = false;
|
||||
immutable bool BACKEND_X11 = false;
|
||||
immutable bool BACKEND_DSFML = false;
|
||||
immutable bool BACKEND_WIN32 = true;
|
||||
} else version(linux) {
|
||||
// Default for Linux: use SDL and OpenGL
|
||||
version = USE_SDL;
|
||||
version = USE_OPENGL;
|
||||
immutable bool ENABLE_OPENGL = true;
|
||||
immutable bool BACKEND_SDL = true;
|
||||
immutable bool BACKEND_X11 = false;
|
||||
immutable bool BACKEND_DSFML = false;
|
||||
immutable bool BACKEND_WIN32 = false;
|
||||
} else version(OSX) {
|
||||
// Default: use SDL and OpenGL
|
||||
version = USE_SDL;
|
||||
version = USE_OPENGL;
|
||||
immutable bool ENABLE_OPENGL = true;
|
||||
immutable bool BACKEND_SDL = true;
|
||||
immutable bool BACKEND_X11 = false;
|
||||
immutable bool BACKEND_DSFML = false;
|
||||
immutable bool BACKEND_WIN32 = false;
|
||||
} else {
|
||||
// Unknown platform: use SDL and OpenGL
|
||||
version = USE_SDL;
|
||||
version = USE_OPENGL;
|
||||
immutable bool ENABLE_OPENGL = true;
|
||||
immutable bool BACKEND_SDL = true;
|
||||
immutable bool BACKEND_X11 = false;
|
||||
immutable bool BACKEND_DSFML = false;
|
||||
immutable bool BACKEND_WIN32 = false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -305,7 +305,7 @@ struct Glyph
|
|||
SubpixelRenderingMode subpixelMode;
|
||||
/// 7: usage flag, to handle cleanup of unused glyphs
|
||||
ubyte lastUsage;
|
||||
version (USE_OPENGL) {
|
||||
static if (ENABLE_OPENGL) {
|
||||
/// 8: unique id of glyph (for drawing in hardware accelerated scenes)
|
||||
uint id;
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ struct NinePatch {
|
|||
Rect padding;
|
||||
}
|
||||
|
||||
version (USE_OPENGL) {
|
||||
static if (ENABLE_OPENGL) {
|
||||
/// non thread safe
|
||||
private __gshared uint drawBufIdGenerator = 0;
|
||||
}
|
||||
|
@ -71,14 +71,14 @@ class DrawBuf : RefCountedObject {
|
|||
return (argb & 0xFFFFFF) | (a << 24);
|
||||
}
|
||||
|
||||
version (USE_OPENGL) {
|
||||
static if (ENABLE_OPENGL) {
|
||||
protected uint _id;
|
||||
/// unique ID of drawbug instance, for using with hardware accelerated rendering for caching
|
||||
@property uint id() { return _id; }
|
||||
}
|
||||
|
||||
this() {
|
||||
version (USE_OPENGL) {
|
||||
static if (ENABLE_OPENGL) {
|
||||
_id = drawBufIdGenerator++;
|
||||
}
|
||||
debug _instanceCount++;
|
||||
|
|
|
@ -97,7 +97,7 @@ struct CustomCharProps {
|
|||
}
|
||||
}
|
||||
|
||||
version (USE_OPENGL) {
|
||||
static if (ENABLE_OPENGL) {
|
||||
|
||||
private __gshared void function(uint id) _glyphDestroyCallback;
|
||||
/**
|
||||
|
@ -802,7 +802,7 @@ struct GlyphCache
|
|||
if (part !is null)
|
||||
foreach(ref item; part) {
|
||||
if (item && !item.lastUsage) {
|
||||
version (USE_OPENGL) {
|
||||
static if (ENABLE_OPENGL) {
|
||||
// notify about destroyed glyphs
|
||||
if (_glyphDestroyCallback !is null) {
|
||||
_glyphDestroyCallback(item.id);
|
||||
|
@ -832,7 +832,7 @@ struct GlyphCache
|
|||
if (part !is null)
|
||||
foreach(ref item; part) {
|
||||
if (item) {
|
||||
version (USE_OPENGL) {
|
||||
static if (ENABLE_OPENGL) {
|
||||
// notify about destroyed glyphs
|
||||
if (_glyphDestroyCallback !is null) {
|
||||
_glyphDestroyCallback(item.id);
|
||||
|
|
|
@ -10,7 +10,7 @@ Authors: Vadim Lopatin, coolreader.org@gmail.com
|
|||
module dlangui.graphics.ftfonts;
|
||||
|
||||
public import dlangui.core.config;
|
||||
version(USE_FREETYPE):
|
||||
static if (ENABLE_FREETYPE):
|
||||
|
||||
import dlangui.graphics.fonts;
|
||||
|
||||
|
@ -324,7 +324,7 @@ class FreeTypeFontFile {
|
|||
}
|
||||
}
|
||||
}
|
||||
version (USE_OPENGL) {
|
||||
static if (ENABLE_OPENGL) {
|
||||
glyph.id = nextGlyphId();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ Authors: Vadim Lopatin, coolreader.org@gmail.com
|
|||
module dlangui.graphics.gldrawbuf;
|
||||
|
||||
public import dlangui.core.config;
|
||||
version (USE_OPENGL):
|
||||
static if (ENABLE_OPENGL):
|
||||
|
||||
import dlangui.graphics.drawbuf;
|
||||
import dlangui.graphics.colors;
|
||||
|
|
|
@ -19,7 +19,7 @@ Authors: Vadim Lopatin, coolreader.org@gmail.com
|
|||
module dlangui.graphics.glsupport;
|
||||
|
||||
public import dlangui.core.config;
|
||||
version(USE_OPENGL):
|
||||
static if (ENABLE_OPENGL):
|
||||
|
||||
import dlangui.core.logger;
|
||||
import derelict.opengl3.gl3;
|
||||
|
|
|
@ -90,6 +90,7 @@ Authors: Vadim Lopatin, coolreader.org@gmail.com
|
|||
|
||||
module dlangui.graphics.resources;
|
||||
|
||||
import dlangui.core.config;
|
||||
import dlangui.graphics.images;
|
||||
import dlangui.graphics.drawbuf;
|
||||
import dlangui.graphics.colors;
|
||||
|
|
|
@ -1353,7 +1353,7 @@ class Platform {
|
|||
return Platform.instance;
|
||||
}
|
||||
|
||||
version (USE_OPENGL) {
|
||||
static if (ENABLE_OPENGL) {
|
||||
private __gshared bool _OPENGL_ENABLED = false;
|
||||
/// check if hardware acceleration is enabled
|
||||
@property bool openglEnabled() { return _OPENGL_ENABLED; }
|
||||
|
@ -1378,12 +1378,6 @@ version (Windows) {
|
|||
|
||||
/// put "mixin APP_ENTRY_POINT;" to main module of your dlangui based app
|
||||
mixin template APP_ENTRY_POINT() {
|
||||
version (linux) {
|
||||
version(USE_X11) {
|
||||
pragma(lib, "X11");
|
||||
}
|
||||
}
|
||||
|
||||
/// workaround for link issue when WinMain is located in library
|
||||
version(Windows) {
|
||||
extern (Windows) int WinMain(void* hInstance, void* hPrevInstance,
|
||||
|
|
|
@ -7,7 +7,7 @@ public import dlangui.graphics.fonts;
|
|||
public import dlangui.graphics.resources;
|
||||
public import dlangui.widgets.widget;
|
||||
|
||||
version(USE_FREETYPE) {
|
||||
static if (ENABLE_FREETYPE) {
|
||||
public import dlangui.graphics.ftfonts;
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@ version (Windows) {
|
|||
import dlangui.platforms.windows.win32fonts;
|
||||
try {
|
||||
/// testing freetype font manager
|
||||
version(USE_FREETYPE) {
|
||||
static if (ENABLE_FREETYPE) {
|
||||
Log.v("Trying to init FreeType font manager");
|
||||
|
||||
import dlangui.graphics.ftfonts;
|
||||
|
@ -236,7 +236,7 @@ extern (C) void releaseResourcesOnAppExit() {
|
|||
if (Drawable.instanceCount > 0) {
|
||||
Log.e("Non-zero Drawable instance count when exiting: ", Drawable.instanceCount);
|
||||
}
|
||||
version (USE_FREETYPE) {
|
||||
static if (ENABLE_FREETYPE) {
|
||||
import dlangui.graphics.ftfonts;
|
||||
if (FreeTypeFontFile.instanceCount > 0) {
|
||||
Log.e("Non-zero FreeTypeFontFile instance count when exiting: ", FreeTypeFontFile.instanceCount);
|
||||
|
|
|
@ -2,7 +2,7 @@ module dlangui.platforms.dsfml.dsfmlapp;
|
|||
|
||||
public import dlangui.core.config;
|
||||
|
||||
version(USE_DSFML):
|
||||
static if (BACKEND_DSFML):
|
||||
|
||||
import dlangui.platforms.common.platform;
|
||||
import dsfml.graphics;
|
||||
|
|
|
@ -18,7 +18,8 @@ Authors: Vadim Lopatin, coolreader.org@gmail.com
|
|||
module dlangui.platforms.sdl.sdlapp;
|
||||
|
||||
public import dlangui.core.config;
|
||||
version(USE_SDL):
|
||||
static if (BACKEND_SDL):
|
||||
|
||||
import core.runtime;
|
||||
import std.conv;
|
||||
import std.string;
|
||||
|
@ -41,7 +42,7 @@ import dlangui.platforms.common.platform;
|
|||
import derelict.sdl2.sdl;
|
||||
import derelict.opengl3.gl3;
|
||||
|
||||
version (USE_OPENGL) {
|
||||
static if (ENABLE_OPENGL) {
|
||||
import dlangui.graphics.gldrawbuf;
|
||||
import dlangui.graphics.glsupport;
|
||||
}
|
||||
|
@ -89,7 +90,7 @@ class SDLWindow : Window {
|
|||
debug Log.d("Destroying SDL window");
|
||||
if (_renderer)
|
||||
SDL_DestroyRenderer(_renderer);
|
||||
version(USE_OPENGL) {
|
||||
static if (ENABLE_OPENGL) {
|
||||
if (_context)
|
||||
SDL_GL_DeleteContext(_context);
|
||||
}
|
||||
|
@ -111,12 +112,12 @@ class SDLWindow : Window {
|
|||
}
|
||||
|
||||
|
||||
version(USE_OPENGL) {
|
||||
static if (ENABLE_OPENGL) {
|
||||
static private bool _gl3Reloaded = false;
|
||||
private SDL_GLContext _context;
|
||||
}
|
||||
|
||||
version(USE_OPENGL) {
|
||||
static if (ENABLE_OPENGL) {
|
||||
protected bool createContext(int versionMajor, int versionMinor) {
|
||||
Log.i("Trying to create OpenGL ", versionMajor, ".", versionMinor, " context");
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, versionMajor);
|
||||
|
@ -146,7 +147,7 @@ class SDLWindow : Window {
|
|||
//if (flags & WindowFlag.Modal)
|
||||
// windowFlags |= SDL_WINDOW_INPUT_GRABBED;
|
||||
windowFlags |= SDL_WINDOW_ALLOW_HIGHDPI;
|
||||
version(USE_OPENGL) {
|
||||
static if (ENABLE_OPENGL) {
|
||||
if (_enableOpengl)
|
||||
windowFlags |= SDL_WINDOW_OPENGL;
|
||||
if (!_glSupport)
|
||||
|
@ -155,7 +156,7 @@ class SDLWindow : Window {
|
|||
_win = SDL_CreateWindow(toUTF8(_caption).toStringz, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
|
||||
_dx, _dy,
|
||||
windowFlags);
|
||||
version(USE_OPENGL) {
|
||||
static if (ENABLE_OPENGL) {
|
||||
if (!_win) {
|
||||
if (_enableOpengl) {
|
||||
Log.e("SDL_CreateWindow failed - cannot create OpenGL window: ", fromStringz(SDL_GetError()));
|
||||
|
@ -173,7 +174,7 @@ class SDLWindow : Window {
|
|||
return false;
|
||||
}
|
||||
|
||||
version(USE_OPENGL) {
|
||||
static if (ENABLE_OPENGL) {
|
||||
if (_enableOpengl) {
|
||||
Log.i("Trying to create OpenGL 3.2 context");
|
||||
createContext(3, 2);
|
||||
|
@ -416,7 +417,7 @@ class SDLWindow : Window {
|
|||
fixSize();
|
||||
|
||||
if (_enableOpengl) {
|
||||
version(USE_OPENGL) {
|
||||
static if (ENABLE_OPENGL) {
|
||||
SDL_GL_MakeCurrent(_win, _context);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glViewport(0, 0, _dx, _dy);
|
||||
|
@ -1301,7 +1302,7 @@ int sdlmain(string[] args) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
version(USE_OPENGL) {
|
||||
static if (ENABLE_OPENGL) {
|
||||
try {
|
||||
DerelictGL3.missingSymbolCallback = &gl3MissingSymFunc;
|
||||
DerelictGL3.load();
|
||||
|
@ -1323,7 +1324,7 @@ int sdlmain(string[] args) {
|
|||
|
||||
int request = SDL_GetDesktopDisplayMode(0,&displayMode);
|
||||
|
||||
version(USE_OPENGL) {
|
||||
static if (ENABLE_OPENGL) {
|
||||
// we want OpenGL 3.2
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION,3);
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION,2);
|
||||
|
|
|
@ -287,7 +287,7 @@ class Win32Font : Font {
|
|||
return null;
|
||||
|
||||
Glyph * g = new Glyph;
|
||||
version (USE_OPENGL) {
|
||||
static if (ENABLE_OPENGL) {
|
||||
g.id = nextGlyphId();
|
||||
}
|
||||
//g.blackBoxX = cast(ushort)metrics.gmBlackBoxX;
|
||||
|
|
|
@ -21,10 +21,9 @@ Authors: Vadim Lopatin, coolreader.org@gmail.com
|
|||
*/
|
||||
module dlangui.platforms.windows.winapp;
|
||||
|
||||
public import dlangui.core.config;
|
||||
version (USE_SDL) { }
|
||||
else version (USE_DSFML) { }
|
||||
else version (Windows) {
|
||||
public import dlangui.core.config;
|
||||
|
||||
static if (BACKEND_WIN32):
|
||||
|
||||
import core.runtime;
|
||||
import win32.windows;
|
||||
|
@ -44,7 +43,7 @@ import dlangui.graphics.fonts;
|
|||
import dlangui.core.logger;
|
||||
import dlangui.core.files;
|
||||
|
||||
version (USE_OPENGL) {
|
||||
static if (ENABLE_OPENGL) {
|
||||
import dlangui.graphics.glsupport;
|
||||
}
|
||||
|
||||
|
@ -63,7 +62,7 @@ immutable WIN_CLASS_NAME = "DLANGUI_APP";
|
|||
__gshared HINSTANCE _hInstance;
|
||||
__gshared int _cmdShow;
|
||||
|
||||
version (USE_OPENGL) {
|
||||
static if (ENABLE_OPENGL) {
|
||||
bool setupPixelFormat(HDC hDC)
|
||||
{
|
||||
PIXELFORMATDESCRIPTOR pfd = {
|
||||
|
@ -161,7 +160,7 @@ class Win32Window : Window {
|
|||
Win32Platform _platform;
|
||||
|
||||
HWND _hwnd;
|
||||
version (USE_OPENGL) {
|
||||
static if (ENABLE_OPENGL) {
|
||||
HGLRC _hGLRC; // opengl context
|
||||
HPALETTE _hPalette;
|
||||
//GLSupport _gl;
|
||||
|
@ -200,7 +199,7 @@ class Win32Window : Window {
|
|||
null, // window menu handle
|
||||
_hInstance, // program instance handle
|
||||
cast(void*)this); // creation parameters
|
||||
version (USE_OPENGL) {
|
||||
static if (ENABLE_OPENGL) {
|
||||
import derelict.opengl3.wgl;
|
||||
|
||||
/* initialize OpenGL rendering */
|
||||
|
@ -222,7 +221,7 @@ class Win32Window : Window {
|
|||
import derelict.opengl3.gl3;
|
||||
DerelictGL3.reload();
|
||||
|
||||
version (USE_OPENGL) {
|
||||
static if (ENABLE_OPENGL) {
|
||||
//_gl = new GLSupport();
|
||||
if (!_glSupport) {
|
||||
Log.v("Creating OpenGL support");
|
||||
|
@ -264,7 +263,7 @@ class Win32Window : Window {
|
|||
}
|
||||
}
|
||||
|
||||
version (USE_OPENGL) {
|
||||
static if (ENABLE_OPENGL) {
|
||||
private void paintUsingOpenGL() {
|
||||
// hack to stop infinite WM_PAINT loop
|
||||
PAINTSTRUCT ps;
|
||||
|
@ -315,7 +314,7 @@ class Win32Window : Window {
|
|||
|
||||
~this() {
|
||||
debug Log.d("Window destructor");
|
||||
version (USE_OPENGL) {
|
||||
static if (ENABLE_OPENGL) {
|
||||
import derelict.opengl3.wgl;
|
||||
if (_hGLRC) {
|
||||
//glSupport.uninitShaders();
|
||||
|
@ -547,7 +546,7 @@ class Win32Window : Window {
|
|||
void onPaint() {
|
||||
debug(DebugRedraw) Log.d("onPaint()");
|
||||
long paintStart = currentTimeMillis;
|
||||
version (USE_OPENGL) {
|
||||
static if (ENABLE_OPENGL) {
|
||||
if (useOpengl && _hGLRC) {
|
||||
paintUsingOpenGL();
|
||||
} else {
|
||||
|
@ -997,7 +996,7 @@ int myWinMain(void* hInstance, void* hPrevInstance, char* lpCmdLine, int iCmdSho
|
|||
|
||||
currentTheme = createDefaultTheme();
|
||||
|
||||
version (USE_OPENGL) {
|
||||
static if (ENABLE_OPENGL) {
|
||||
try {
|
||||
import derelict.opengl3.gl3;
|
||||
DerelictGL3.load();
|
||||
|
@ -1196,6 +1195,4 @@ LRESULT WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
//===========================================
|
||||
// end of version(Windows)
|
||||
//===========================================
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
module dlangui.platforms.x11.x11app;
|
||||
|
||||
public import dlangui.core.config;
|
||||
version (USE_X11):
|
||||
static if (BACKEND_X11):
|
||||
|
||||
import dlangui.core.logger;
|
||||
import dlangui.core.events;
|
||||
|
@ -23,7 +23,7 @@ import x11.Xutil;
|
|||
import x11.Xtos;
|
||||
import x11.X;
|
||||
|
||||
version (USE_OPENGL) {
|
||||
static if (ENABLE_OPENGL) {
|
||||
import derelict.opengl3.gl3;
|
||||
import derelict.opengl3.gl;
|
||||
import dlangui.graphics.gldrawbuf;
|
||||
|
@ -178,7 +178,7 @@ class X11Window : DWindow {
|
|||
protected GC _gc;
|
||||
private __gshared XIC xic;
|
||||
|
||||
version (USE_OPENGL) {
|
||||
static if (ENABLE_OPENGL) {
|
||||
GLXContext _glc;
|
||||
}
|
||||
|
||||
|
@ -214,7 +214,7 @@ class X11Window : DWindow {
|
|||
EnterWindowMask | LeaveWindowMask | PointerMotionMask | ButtonMotionMask | ExposureMask | VisibilityChangeMask |
|
||||
FocusChangeMask | KeymapStateMask | StructureNotifyMask;
|
||||
Visual * visual = DefaultVisual(x11display, x11screen);
|
||||
version (USE_OPENGL) {
|
||||
static if (ENABLE_OPENGL) {
|
||||
if (_enableOpengl) {
|
||||
swamask |= CWColormap;
|
||||
swa.colormap = x11cmap;
|
||||
|
@ -296,7 +296,7 @@ class X11Window : DWindow {
|
|||
if (timer) {
|
||||
timer.stop();
|
||||
}
|
||||
version(USE_OPENGL) {
|
||||
static if (ENABLE_OPENGL) {
|
||||
if (_glc) {
|
||||
glXDestroyContext(x11display, _glc);
|
||||
_glc = null;
|
||||
|
@ -312,26 +312,12 @@ class X11Window : DWindow {
|
|||
}
|
||||
}
|
||||
|
||||
// version(USE_OPENGL) {
|
||||
// protected bool createContext(int versionMajor, int versionMinor) {
|
||||
// Log.i("Trying to create OpenGL ", versionMajor, ".", versionMinor, " context");
|
||||
// SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, versionMajor);
|
||||
// SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, versionMinor);
|
||||
// _glc = SDL_GL_CreateContext(_win); // Create the actual context and make it current
|
||||
// if (!_context)
|
||||
// Log.e("SDL_GL_CreateContext failed: ", fromStringz(SDL_GetError()));
|
||||
// else
|
||||
// Log.i("Created successfully");
|
||||
// return _context !is null;
|
||||
// }
|
||||
// }
|
||||
|
||||
/// show window
|
||||
override void show() {
|
||||
Log.d("X11Window.show");
|
||||
XMapRaised(x11display, _win);
|
||||
XFlush(x11display);
|
||||
version(USE_OPENGL) {
|
||||
static if (ENABLE_OPENGL) {
|
||||
if (_enableOpengl) {
|
||||
_glc = glXCreateContext(x11display, x11visual, null, GL_TRUE);
|
||||
if (!_glc) {
|
||||
|
@ -448,7 +434,7 @@ class X11Window : DWindow {
|
|||
}
|
||||
|
||||
protected void drawUsingOpengl() {
|
||||
version(USE_OPENGL) {
|
||||
static if (ENABLE_OPENGL) {
|
||||
//Log.d("drawUsingOpengl()");
|
||||
glXMakeCurrent(x11display, cast(uint)_win, _glc);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
|
@ -1385,7 +1371,7 @@ extern(C) int DLANGUImain(string[] args)
|
|||
|
||||
x11screen = DefaultScreen(x11display);
|
||||
|
||||
version(USE_OPENGL) {
|
||||
static if (ENABLE_OPENGL) {
|
||||
try {
|
||||
DerelictGL3.missingSymbolCallback = &gl3MissingSymFunc;
|
||||
DerelictGL3.load();
|
||||
|
|
Loading…
Reference in New Issue