iDevGames Forums

Full Version: Some questions.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have a few questions about OpenGL.

1. In my uDG entry this year, I will have a BIG landskape, should I do some simple optimization checks myself (like not sending polygons that are behind the camera to be rendered), or will OpenGL do this for me?

2. How do I load a 3DMF file? I searched for some code to do it, but I can't find any. I think I may just have to write my own here...

3. If I have a sphere rolling on a surface (made up of hundreds of triangles), how would I do the collision detection. This is what I thought up on my own, but I'm new so its probably wrong.

A: Find out that the sphere actually hit the polygon
B: Find the angle of the polygon it hit
C: ??? I'm confused here, is this a place I would use the dot product to get the new vector?


4. What happens if the sphere hits 2 polygons at once (example, on the top of a hill 1/4th of the sphere is leaning towards the right, and 3/4th is leaning left).

Thanks in advance
>>1. In my uDG entry this year, I will have a BIG landskape, should I do some simple optimization checks myself (like not sending polygons that are behind the camera to be rendered), or will OpenGL do this for me?

check yourself

>>2. How do I load a 3DMF file? I searched for some code to do it, but I can't find any. I think I may just have to write my own here...

http://myfileformats.com/ search there, I think I might have to FAQ that.

Jesse

With large worlds, it's generally a good idea to have some rough visibility determination to avoid sending lots of polys you know won't be visible (such as those outside of the view frustum). If your visibility algorithm gets too complicated, however, it may be faster to just let OpenGL sort it out. Most pro games have some visibility determination, though. Options include BSP, octree, quadtree (for landscapes), volume hierarchy, etc.

The ball thing is a non-trivial problem, but here are a couple of thoughts. If your landscape is a heightmap arranged in a regular grid, you should be able to extract a height value and a normal at any point (such as the position of the ball). Comparing the ball's y position with the landscape height plus the ball's radius will tell you (roughly) whether the ball is intersecting the landscape at that point. You can then use the landscape normal to apply the appropriate physics to the ball, such as rolling or bouncing.

The details are a little more complicated, but maybe that will get you started.
Quote:http://myfileformats.com/ search there, I think I might have to FAQ that.


Thats so weird... I checked that exact site before I posted, and when I clicked 3dmf nothing happened, after quiting safari and posting this question, it seams to work now!

Wacko



Quote:he ball thing is a non-trivial problem, but here are a couple of thoughts. If your landscape is a heightmap arranged in a regular grid, you should be able to extract a height value and a normal at any point (such as the position of the ball). Comparing the ball's y position with the landscape height plus the ball's radius will tell you (roughly) whether the ball is intersecting the landscape at that point. You can then use the landscape normal to apply the appropriate physics to the ball, such as rolling or bouncing.



Actually i'm just using a 3D world made up of polygons, not a height map.
There is a 3DMF loader for Cocoa in the source code section.
Reference URL's