Sign in to follow this  
Ropeburn

Oblique Project - Shearing object back into viewing window.

Recommended Posts

I have a small application that take 'pictures' of 256x256 oblique renders of a model. I am having difficulty understanding the oblique or shear projection. Basically, I have a model described within coordinates -1,1,-1,1,-1,1. When I set up a camera normally at 0,0,-1 I get a parallal projection as you'd expect. I'd like to move the model to 0.5,0.5,-1 for example but project the model back using a oblique projection. I have read all these very interesting explains and just don't get it. Can someone please explain in how I can do this. How do I modify my projection matrix? Is there a better way to view obliquely from the side? Thomas. // my default projection setup // glViewport(0, 0, (GLint) width, (GLint) height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 2.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); // my on render code. // zDB dx = 2.0/256.0; zDB dy = 2.0/256.0; for (EVER) { for (zUL i = 0;i < NSHRIDS;i++) { pSeg = (zRdrSeg *)_shrAddr[i]; if (pSeg->_renderState == RenderAssigned) { zPIXEL *p = zMHSHR_PMEM(pSeg); glClear(GL_COLOR_BUFFER_BIT); x = -1.0 + (dx * (zDB)pSeg->_x); y = -1.0 + (dy * (zDB)pSeg->_y); z = -1.0; // DinkProjectionMatrix(); glPushMatrix(); glTranslatef(x,y,z); _pModel->draw(); glPopMatrix(); glXSwapBuffers(_pDisplay,_xWindow); glReadPixels(0,0, _scrWidth,_scrHeight, GL_RGB, GL_UNSIGNED_BYTE, p); pSeg->_renderState = RenderComplete; } } }

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this