Archived

This topic is now archived and is closed to further replies.

serba

Orthogonal and perspective projection combination

Recommended Posts

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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
My voxel landscape is fully hardware accelerated (it''s psevdo voxel landscape)! It''s possible to adopt voxel for hardware acceleration! Check source!

Share this post


Link to post
Share on other sites
>>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

Share this post


Link to post
Share on other sites