Jump to content
  • Advertisement
Sign in to follow this  

Oblique Project - Shearing object back into viewing window.

This topic is 4745 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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; 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
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!