mirror of https://github.com/buggins/dlangui.git
OpenGL example for legacy API
This commit is contained in:
parent
809794d15a
commit
57aba53bf5
|
@ -1014,8 +1014,9 @@ static if (ENABLE_OPENGL) {
|
||||||
override void animate(long interval) {
|
override void animate(long interval) {
|
||||||
if (_oldApi) {
|
if (_oldApi) {
|
||||||
// rotate gears
|
// rotate gears
|
||||||
angle += interval * 0.000005f;
|
angle += interval * 0.000002f;
|
||||||
} else {
|
} else {
|
||||||
|
// animate new API example
|
||||||
}
|
}
|
||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
|
@ -1205,9 +1206,6 @@ static if (ENABLE_OPENGL) {
|
||||||
glxgears_reshape(Rect rc)
|
glxgears_reshape(Rect rc)
|
||||||
{
|
{
|
||||||
GLfloat h = cast(GLfloat) rc.height / cast(GLfloat) rc.width;
|
GLfloat h = cast(GLfloat) rc.height / cast(GLfloat) rc.width;
|
||||||
|
|
||||||
glViewport(rc.top, rc.left, cast(GLint)rc.width, cast(GLint)rc.height);
|
|
||||||
//glViewport(0, 0, cast(GLint) width, cast(GLint) height);
|
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
glFrustum(-1.0, 1.0, -h, h, 5.0, 60.0);
|
glFrustum(-1.0, 1.0, -h, h, 5.0, 60.0);
|
||||||
|
|
|
@ -923,10 +923,12 @@ public:
|
||||||
}
|
}
|
||||||
override void draw() {
|
override void draw() {
|
||||||
if (_handler) {
|
if (_handler) {
|
||||||
|
|
||||||
import derelict.opengl3.gl3 : glViewport;
|
import derelict.opengl3.gl3 : glViewport;
|
||||||
glViewport(_rc.left, _rc.top, _rc.right, _rc.bottom);
|
glViewport(_rc.left, _buf.height - _rc.bottom, _rc.width, _rc.height);
|
||||||
_handler(_buf, _rc);
|
_handler(_buf, _rc);
|
||||||
glSupport.setOrthoProjection(Rect(0, 0, _buf.width, _buf.height));
|
glSupport.setOrthoProjection(Rect(0, 0, _buf.width, _buf.height));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue