Orthogonal and perspective projection combination

Started by
3 comments, last by serba 21 years, 8 months ago
Hi! Simple question… How to combine «together» glOrtho and gluPerspective? The problem description is – I render voxel based landscape using glOrtho (it’s only one way), but then, I must add 3d models… As far as I understand I must use perspective projection for models… I’m not expert in OpenGL, and I found simple solution: void Render() { glMatrixMode (GL_PROJECTION); glLoadIdentity (); glOrtho(0, 1024, 0, 768,0, 4096); glMatrixMode (GL_MODELVIEW); glLoadIdentity(); // Render voxel landscape glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(45.0,1024.f/768.f,1,350.0); glMatrixMode(GL_MODELVIEW); // Render 3d models } All work, but performance drop dramatically! (from 85 even 20 fps, even if model have less the 200 polygons). I understand, must exist another way to doing this. Any ideas? The link to voxel source: http://immerse.km.ru/download/project/voxel071.zip
Advertisement
Using ortho and perspective at the same time isn''t your source of slow-down, as pretty much every game does it.

I would imagine your voxel rendering is slow, as it''s not something that 3d cards are good at.

Helpful links:
How To Ask Questions The Smart Way | Google can help with your question | Search MSDN for help with standard C or Windows functions
My voxel landscape is fully hardware accelerated (it''s psevdo voxel landscape)! It''s possible to adopt voxel for hardware acceleration! Check source!

>>The problem description is – I render voxel based landscape using glOrtho (it’s only one way), but then, I must add 3d models… As far as I understand I must use perspective projection for models…<<

no, not at all.
pick either orthogonal or perspective + render BOTH voxels + 3d models in the same way.
BTW perspective with a small FOV eg 10deg looks very much like orthogonal. ie distance doesnt change scale (that much)

http://uk.geocities.com/sloppyturds/gotterdammerung.html
Try rendering your voxels OR your poly models, not both, then see where the slowdown is.

Helpful links:
How To Ask Questions The Smart Way | Google can help with your question | Search MSDN for help with standard C or Windows functions

This topic is closed to new replies.

Advertisement