3d Engine Stuff

Started by
3 comments, last by GarethThomas 23 years, 7 months ago
Hi there! I''m currently writing a FPS engine and have two questions: 1) I used to use a glu cylinder as the weapon and rendered it last with the depth test off (just like Trinity) - this stopped the weapon from disappearing into the walls etc... Now I''m using a weapon constructed from triangles and this needs the depth buffer. How can I make the weapon draw over the walls? 2) I''m using planes to define the visible volume. I''m then using these planes to determine the visible polys in that sector. I can calculate these planes when looking through my portals (the planes are calculated using my position and the edges of the portal). This all works fine but I get a bit (very) confused when calculating the planes for the sector I am in. How are the four planes defined in world space for the initial FOV? Thanks in advance for the help.
Advertisement
1)
You have to sort polygons to render them from back to front
(you can find me on IRC : #opengl on undernet)
1) Don''t disable the depth test!
Do it like this:

render world
glDepthRange (0, 0.3);
render weapon
glDepthRange (0, 1);

Bruno
2/ an easy way to get the viewing planes if youre willing to get info from the card is in the faq
Thanks guys for your help.

The depth range suggestion worked a treat.

The FAQ sample code ViewCull.c solved my view frustum problems straight away. I''m sure there is a more direct way to calculate the frustum planes - it''s just that I can''t get my head around the trig! However, the current solution will do just fine for now.

This topic is closed to new replies.

Advertisement