mirror of https://github.com/buggins/dlangui.git
fix opengl on win32
This commit is contained in:
parent
a2a4523e13
commit
d73eeb0c3f
|
@ -14,6 +14,9 @@ mixin APP_ENTRY_POINT;
|
||||||
|
|
||||||
/// entry point for dlangui based application
|
/// entry point for dlangui based application
|
||||||
extern (C) int UIAppMain(string[] args) {
|
extern (C) int UIAppMain(string[] args) {
|
||||||
|
// embed resources listed in views/resources.list into executable
|
||||||
|
embeddedResourceList.addResources(embedResourcesFromList!("resources.list")());
|
||||||
|
|
||||||
// create window
|
// create window
|
||||||
Window window = Platform.instance.createWindow("DlangUI example - 3D Application", null, WindowFlag.Resizable, 600, 500);
|
Window window = Platform.instance.createWindow("DlangUI example - 3D Application", null, WindowFlag.Resizable, 600, 500);
|
||||||
window.mainWidget = new UiWidget();
|
window.mainWidget = new UiWidget();
|
||||||
|
|
|
@ -1086,7 +1086,13 @@ class GLVertexBuffer : VertexBuffer {
|
||||||
|
|
||||||
/// bind into current context
|
/// bind into current context
|
||||||
override void bind() {
|
override void bind() {
|
||||||
glBindVertexArray(_vao);
|
checkgl!glBindVertexArray(_vao);
|
||||||
|
|
||||||
|
// TODO: is it necessary to bind vertex/index buffers?
|
||||||
|
// specify vertex buffer
|
||||||
|
checkgl!glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer);
|
||||||
|
// specify index buffer
|
||||||
|
checkgl!glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _indexBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// unbind from current context
|
/// unbind from current context
|
||||||
|
@ -1102,8 +1108,10 @@ class GLVertexBuffer : VertexBuffer {
|
||||||
for(int i = 0; i < _format.length; i++) {
|
for(int i = 0; i < _format.length; i++) {
|
||||||
int loc = effect.getVertexElementLocation(_format[i].type);
|
int loc = effect.getVertexElementLocation(_format[i].type);
|
||||||
if (loc >= 0) {
|
if (loc >= 0) {
|
||||||
glVertexAttribPointer(loc, _format[i].size, GL_FLOAT, GL_FALSE, _format.vertexSize, cast(char*)(offset));
|
checkgl!glVertexAttribPointer(loc, _format[i].size, GL_FLOAT, GL_FALSE, _format.vertexSize, cast(char*)(offset));
|
||||||
glEnableVertexAttribArray(loc);
|
checkgl!glEnableVertexAttribArray(loc);
|
||||||
|
} else {
|
||||||
|
Log.d("Attribute location not found for ", _format[i].type);
|
||||||
}
|
}
|
||||||
offset += _format[i].byteSize;
|
offset += _format[i].byteSize;
|
||||||
}
|
}
|
||||||
|
|
|
@ -223,11 +223,6 @@ class Win32Window : Window {
|
||||||
Win32Platform _platform;
|
Win32Platform _platform;
|
||||||
|
|
||||||
HWND _hwnd;
|
HWND _hwnd;
|
||||||
static if (ENABLE_OPENGL) {
|
|
||||||
HGLRC _hGLRC; // opengl context
|
|
||||||
HPALETTE _hPalette;
|
|
||||||
//GLSupport _gl;
|
|
||||||
}
|
|
||||||
dstring _caption;
|
dstring _caption;
|
||||||
Win32ColorDrawBuf _drawbuf;
|
Win32ColorDrawBuf _drawbuf;
|
||||||
bool useOpengl;
|
bool useOpengl;
|
||||||
|
@ -560,7 +555,7 @@ class Win32Window : Window {
|
||||||
debug(DebugRedraw) Log.d("onPaint()");
|
debug(DebugRedraw) Log.d("onPaint()");
|
||||||
long paintStart = currentTimeMillis;
|
long paintStart = currentTimeMillis;
|
||||||
static if (ENABLE_OPENGL) {
|
static if (ENABLE_OPENGL) {
|
||||||
if (useOpengl && _hGLRC) {
|
if (useOpengl && sharedGLContext._hGLRC) {
|
||||||
paintUsingOpenGL();
|
paintUsingOpenGL();
|
||||||
} else {
|
} else {
|
||||||
paintUsingGDI();
|
paintUsingGDI();
|
||||||
|
|
Loading…
Reference in New Issue