[Plib-users] axes, OpenGL primitives and other confusion.
Brought to you by:
sjbaker
|
From: Stafford G. <su...@ma...> - 2000-06-10 03:18:10
|
Hi again,
Thanks to those who gave me some pointers before.
1)
I am having major trouble with this coordinate system stuff. I did some more
tests, and i really must insist that the axis of rotation is different to the
axis of translation in plib. Whilst i will shortly be using opengl with plib
together (thanks to Steve) these tests were done using only plibssg
coordinate systems.
Here is the startup code i use for the position of my helicopter:
model_obj->lin_p[0] = 0.0; // model_obj can be considered a structure that
model_obj->lin_p[1] = 0.0; // holds the angle (ang_p), and position
model_obj->lin_p[2] = 90.0; // (lin_p) values of the model.
model_obj->ang_p[0] = 0.0;
model_obj->ang_p[1] = 0.0;
model_obj->ang_p[2] = 0.0;
Then later on, every frame calls this:
sgSetCoord(&modelpos, model_obj->lin_p, model_obj->ang_p);
model -> setTransform(&modelpos);
ssgCullAndDraw ( scene ) ; // model is a ssgTransform in scene
This puts the helicopter at 90 units above the 'ground' (which is at 0,0,0),
and indicates as you have all pointed out that the z is up axis for plib.
Now, suppose i want to rotate around z? This would be equivalent to the
helicopter spinning as if its tail rotor were being activated. Since z is up,
and the axis i want to rotate around, i should be able to do this:
model_obj->lin_p[0] = 0.0;
model_obj->lin_p[1] = 0.0;
model_obj->lin_p[2] = 90.0;
model_obj->ang_p[0] = 0.0;
model_obj->ang_p[1] = 0.0;
model_obj->ang_p[2] = 90.0;
But alas, the helicopter then ends up rotated 90 degrees around the axis going
into the screen (y?), not z. This indicates to me that the axis of rotation is
different than the axis of translation.
If i am mistaken anywhere here please point out where im wrong, but if this is
true... well im stumped as to how to do rotations relative to the object
properly :(
2)
On Steve's note about drawing with both opengl and ssg, I tried using a
ssgSimpleState method, but it just produced lots of red flashes. (my lines
are supposed to be red) I will continue to work on it, since i suspect it is
a problem with my lines being in the wrong place or something like that, but
in the process, i think i found a another bug in plib :) When i call
ssgSimpleState->disable(), it produces a message:
'Illegal mode passed to ssgSimpleState::disable(X)'
where 'X' is the mode given to the call. (I tried this with modes 0, 2 and 5
(SSG_GL_TEXTURE_EN, SSG_GL_COLOR_MATERIAL_EN, SSG_GL_LIGHTING_EN; probably
not in that order :)
Oh btw, if you feel like being a hero and playing with the whole code :), you
can get it from anonymous cvs at sourceforge under the geome project:
ano...@cv...:/cvsroot/geome
checkout the 'demos' module
--
Stafford Goodsell <su...@po...> _
C")
Programmer, administrator, avid gamer and all-round computer geek (_)
http://www.marys.dyndns.org/ -"-
|