View Full Version : using ode collision detection and faking cameras?

05-03-2005, 07:11 PM
1) Does someone wnat to share a small snippet showing how to make a cube react with another cube (this other cube as floor, or it can be a quad too) using ODE? because i dont understand the collision part i found no examples nor explicit tutorials about this on their site nor on the net!!

2) How can I fake a camera in OpenGL? do i really need to move all in order to give the impression that the camera moves (this sounds so stupid to me, doesnt DX support real cameras? then isnt it possible to do cameras with out classes or big libraries for c++ in opengl?!).

05-04-2005, 12:02 AM
Your first part requires simple transformation in OpenGL, that's the easy part, the tricky part is to drive that transformation with a physics simulation and collision detection. You need to research those topics to have geometry interract correctly, but that may be more advanced than you need.

Your second part is really simple. A camera encapsulates multiple things in a graphics library. First there's the projection typically a glFrustum call on the projection matrix. Secondly there's the viewing transformation, typically the first transformation applied to the modelview matrix, before lights are positioned in OpenGL.

So two matrix operations each with supported functions built into OpenGL is hardly something you need to define a camera for (if you need it what's stopping you?). This is even clearer when you understand through experience that a camera model imposes restrictions on a graphics application, for example positioning lights in eye space would become problematic requiring as much attention to how you used the camera sa make it useless. Similar problems arise with a slew of other operations.

Cameras generally are best suited to higher level graphics programming, not the lower level calls of OpenGL. Cameras also generally need culling sorting and drawing routines associated to be truly worthwhile in a graphics application and again that's really for a different style of higher level graphics programming than OpenGL.

05-04-2005, 10:13 AM
thanks dorbie i gotta say that i read better code than english . but i understood all. what i want is to make a high level camera function for myself because ill have multiple cameras and i think it would be easyer to define them and also to access- and why not for using in a later project.

about ODE i just want to know how to define the ''spaces'' and check collision between them. i already apply the body position to my opengl cube position and added gravity so if i run the program the cube goes slow gaining speed of course it passes through the floor, thats what i want to work on, collision in ODE.