Hi Allthat,
actually the 3D engine isn't based on openGl itself. I've made the programming logic similar to what you can do with openGl so it will be easy to code for the engine with openGl experience. I've gone one step further and made the camera controlled like an object in 3D space. In openGl I always had the most trouble bending my mind around the inverse camera rotations and translations applied to the 3Dworld.
here is a code snippet that shows how setting up the camera works.
Code:
//////////////////////////////
/// Setup Camera
myLaserOut->camSetMatrix(x,y,z, heading, pitch, roll);
/*
// The above line does the same as these 5 lines:
myLaserOut->camIdentity(); // reset camera transformation matrix
// translate
myLaserOut->camTranslate(x, y, z);
// rotate
myLaserOut->camRotate( 0, 0, 1, heading ); // z axis
myLaserOut->camRotate( 0, 1, 0, pitch ); // y axis
myLaserOut->camRotate( 1, 0, 0, roll ); // x axis
*/
//////////////////////////////
basically it works the same for any object. Once the geometry is loaded it can be positioned, rotated, and scaled with similar code as above.
Loading geometry from file goes something like this:
Code:
loadIlda("./media/3Dworld4.ild", &ildaframes);
//grid
ildaframes[0].overlay = false; // 3D object
ildaframes[0].setDim(); // set bounding sphere etc.
double sg = 1.0; // scale
ildaframes[0].setMatrix(0,0,0, 0,0,0, sg, sg, sg); //position, rotations, scale