Re: [Plib-users] OpenGL primitives
Brought to you by:
sjbaker
From: Steve B. <sjb...@ai...> - 2000-06-09 13:28:06
|
Stafford Goodsell wrote: > Im trying to debug some physics code i have, and i would like to draw a > 'force vector' (GL_LINE) indicating where the force is applied. However, when > i do, it does not show. (Yes i did it between glBegin/glEnd pairs) I think it > is because im also using the ssg library to draw the main scene. Well for starters, you need GL_LINES the 'S' is important! It's *really* annoying that OpenGL defines a valid token 'GL_LINE' - but it's not the token you pass to glBegin() - always use 'GL_LINES' - even if you are only drawing one line! However, that may not be your only problem because SSG generally leaves OpenGL in an unspecified state - texture might be enabled - or lighting might be turned on with the glMaterial specifying an alpha of zero (hence invisible lines)...you really don't know...but we've thought about this, so... > Is it possible to draw using both OpenGL and ssg scenes at the same time? Yes - I do that all the time. You'll probably need to do things like disabling texture, make sure that the modelview and projection matrices are what you want (SSG has functions to help with that). The easiest way to get the OpenGL state to be what you want is to define an ssgSimpleState object for your GL_LINES and to call: my_state->apply () ; ...just before you start drawing. That way, SSG will change the current state to do what you want without you having to worry about what states SSG might have messed with. > Also, the reason i need to debug this code so intensely is because it seems > that the axes are different depending on if you are rotating or translating... > for translating x appears to be -, y is |, and z is . (into the screen), but > for rotations, x is around |, y is around -, and z is the same. SSG uses a Z-is-up, X-is-right and Y-is-into-the-screen coordinate system, with heading, pitch and roll defined appropriately for that coordinate system. > For example i can only get a helicopter to rotate around the > global y axis (|) not its own y axis, which may be totally different. > See http://marys.dyndns.org/~surge/geome/ for some pictures of this. I think you need to read my paper: http://web2.airmail.net/sjbaker1/matrices_can_be_your_friends.html -- Steve Baker http://web2.airmail.net/sjbaker1 sjb...@ai... (home) http://www.woodsoup.org/~sbaker sj...@ht... (work) |