OpenGL example for legacy API

This commit is contained in:
Vadim Lopatin 2015-12-21 09:46:14 +03:00
parent 809794d15a
commit 57aba53bf5
2 changed files with 5 additions and 5 deletions

View File

@ -1014,8 +1014,9 @@ static if (ENABLE_OPENGL) {
override void animate(long interval) {
if (_oldApi) {
// rotate gears
angle += interval * 0.000005f;
angle += interval * 0.000002f;
} else {
// animate new API example
}
invalidate();
}
@ -1205,9 +1206,6 @@ static if (ENABLE_OPENGL) {
glxgears_reshape(Rect rc)
{
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);
glLoadIdentity();
glFrustum(-1.0, 1.0, -h, h, 5.0, 60.0);

View File

@ -923,10 +923,12 @@ public:
}
override void draw() {
if (_handler) {
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);
glSupport.setOrthoProjection(Rect(0, 0, _buf.width, _buf.height));
}
}
}