mirror of https://github.com/buggins/dlangui.git
fix nvidia problem
This commit is contained in:
parent
8e9a52dbfa
commit
9446401bb4
|
@ -71,7 +71,6 @@ class GLDrawBuf : DrawBuf, GLConfigCallback {
|
||||||
_scene.reset();
|
_scene.reset();
|
||||||
}
|
}
|
||||||
_scene = new Scene(this);
|
_scene = new Scene(this);
|
||||||
glSupport.prepareShaders();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// reserved for hardware-accelerated drawing - ends drawing batch
|
/// reserved for hardware-accelerated drawing - ends drawing batch
|
||||||
|
@ -79,6 +78,7 @@ class GLDrawBuf : DrawBuf, GLConfigCallback {
|
||||||
glSupport.setOrthoProjection(Rect(0, 0, _dx, _dy), Rect(0, 0, _dx, _dy));
|
glSupport.setOrthoProjection(Rect(0, 0, _dx, _dy), Rect(0, 0, _dx, _dy));
|
||||||
_scene.draw();
|
_scene.draw();
|
||||||
GLProgram.unbind();
|
GLProgram.unbind();
|
||||||
|
glSupport.destroyBuffers();
|
||||||
glSupport.flushGL();
|
glSupport.flushGL();
|
||||||
destroy(_scene);
|
destroy(_scene);
|
||||||
_scene = null;
|
_scene = null;
|
||||||
|
|
|
@ -292,13 +292,8 @@ class SolidFillProgram : GLProgram {
|
||||||
VAO vao;
|
VAO vao;
|
||||||
VBO vbo;
|
VBO vbo;
|
||||||
bool needToCreateVAO = true;
|
bool needToCreateVAO = true;
|
||||||
void createVAO(float[] vertices, float[] colors) {
|
protected void createVAO(float[] vertices, float[] colors) {
|
||||||
if(vao)
|
|
||||||
destroy(vao);
|
|
||||||
vao = new VAO;
|
vao = new VAO;
|
||||||
|
|
||||||
if(vbo)
|
|
||||||
destroy(vbo);
|
|
||||||
vbo = new VBO;
|
vbo = new VBO;
|
||||||
|
|
||||||
glVertexAttribPointer(vertexLocation, 3, GL_FLOAT, GL_FALSE, 0, cast(void*) 0);
|
glVertexAttribPointer(vertexLocation, 3, GL_FLOAT, GL_FALSE, 0, cast(void*) 0);
|
||||||
|
@ -310,7 +305,7 @@ class SolidFillProgram : GLProgram {
|
||||||
needToCreateVAO = false;
|
needToCreateVAO = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void beforeExecute() {
|
protected void beforeExecute() {
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
checkgl!glDisable(GL_CULL_FACE);
|
checkgl!glDisable(GL_CULL_FACE);
|
||||||
checkgl!glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
checkgl!glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
@ -334,6 +329,14 @@ class SolidFillProgram : GLProgram {
|
||||||
vao.unbind();
|
vao.unbind();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void destroyBuffers() {
|
||||||
|
destroy(vao);
|
||||||
|
destroy(vbo);
|
||||||
|
vao = null;
|
||||||
|
vbo = null;
|
||||||
|
needToCreateVAO = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class LineProgram : SolidFillProgram {
|
class LineProgram : SolidFillProgram {
|
||||||
|
@ -392,13 +395,8 @@ class TextureProgram : SolidFillProgram {
|
||||||
return res && texCoordLocation >= 0;
|
return res && texCoordLocation >= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void createVAO(float[] vertices, float[] colors, float[] texcoords) {
|
protected void createVAO(float[] vertices, float[] colors, float[] texcoords) {
|
||||||
if(vao)
|
|
||||||
destroy(vao);
|
|
||||||
vao = new VAO;
|
vao = new VAO;
|
||||||
|
|
||||||
if(vbo)
|
|
||||||
destroy(vbo);
|
|
||||||
vbo = new VBO;
|
vbo = new VBO;
|
||||||
|
|
||||||
glVertexAttribPointer(vertexLocation, 3, GL_FLOAT, GL_FALSE, 0, cast(void*) 0);
|
glVertexAttribPointer(vertexLocation, 3, GL_FLOAT, GL_FALSE, 0, cast(void*) 0);
|
||||||
|
@ -598,10 +596,10 @@ final class GLSupport {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void prepareShaders() {
|
void destroyBuffers() {
|
||||||
_solidFillProgram.needToCreateVAO = true;
|
_solidFillProgram.destroyBuffers();
|
||||||
_lineProgram.needToCreateVAO = true;
|
_lineProgram.destroyBuffers();
|
||||||
_textureProgram.needToCreateVAO = true;
|
_textureProgram.destroyBuffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
void setRotation(int x, int y, int rotationAngle) {
|
void setRotation(int x, int y, int rotationAngle) {
|
||||||
|
|
Loading…
Reference in New Issue