X-Git-Url: http://git.rot13.org/?p=simavr;a=blobdiff_plain;f=examples%2Fboard_reprap%2Fsrc%2Freprap_gl.c;h=2ed140c07a42f949fac564a4cf1f19635a13c429;hp=b11f874e23065a60b9766bd7a0a73b1c2e0a24f3;hb=1d39956926c07a7625830872db830789a8dda508;hpb=7303a27e00000a7ff6e2bba401d99b421df2c02b diff --git a/examples/board_reprap/src/reprap_gl.c b/examples/board_reprap/src/reprap_gl.c index b11f874..2ed140c 100644 --- a/examples/board_reprap/src/reprap_gl.c +++ b/examples/board_reprap/src/reprap_gl.c @@ -162,6 +162,7 @@ _gl_reshape_cb(int w, int h) _w = w; _h = h; + glBindFramebuffer(GL_FRAMEBUFFER, 0); glViewport(0, 0, _w, _h); gl_offscreenReshape(_w, _h); glutPostRedisplay(); @@ -238,9 +239,9 @@ _gl_display_cb(void) /* function called whenever redisplay needed */ // Set up projection matrix glMatrixMode(GL_PROJECTION); // Select projection matrix - glLoadIdentity(); // Start with an identity matrix + c3mat4 p = perspective3D(50, (float)_w / (float)_h, z_min, z_max); + glLoadMatrixf(p.n); - gluPerspective(50, (float)_w / (float)_h, z_min, z_max); #if 0 glCullFace(GL_BACK); glEnable(GL_CULL_FACE); @@ -257,14 +258,6 @@ _gl_display_cb(void) /* function called whenever redisplay needed */ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Type Of Blending To Use glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - - glMultMatrixf(c3context_view_get(c3)->cam.mtx.n); - glTranslatef(-c3context_view_get(c3)->cam.eye.n[VX], - -c3context_view_get(c3)->cam.eye.n[VY], - -c3context_view_get(c3)->cam.eye.n[VZ]); - - dumpError("flush"); c3context_draw(c3); @@ -290,7 +283,6 @@ _gl_display_cb(void) /* function called whenever redisplay needed */ glScalef(1, -1, 1); glTranslatef(0, -1 * _h, 0); glMatrixMode(GL_MODELVIEW); // Select modelview matrix - glLoadIdentity(); // Start with an identity matrix if (hud) c3context_draw(hud);