Re: [Plib-users] OpenGL primitives
Brought to you by:
sjbaker
|
From: Land T. S. <lan...@am...> - 2000-06-09 02:05:04
|
Hello Stafford,
I don't know about 2d drawing, but I have a starfield in the back of one of my
menus -- here is the code I use:
void StarField::Draw()
{
int i;
float *px, *py, *pz;
static float c = 0.0f;
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
gluPerspective(90.0f, 640.0f/480.0f, 1.0, 500.0);
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
gluLookAt( 0.0, 0.0, -5.0f,
0.0, 0.0, 0.0,
0.0, 1.0, 0.0 );
px = x;
py = y;
pz = z;
glDisable(GL_LIGHTING);
glPointSize(1.0f);
glBegin( GL_POINTS );
for( i=0; i<numStars; i++ )
{
glColor3f( 1.0f - *pz / STAR_MAXZ,
1.0f - *pz / STAR_MAXZ,
1.0f - *pz / STAR_MAXZ);
glVertex3f( *px, *py, *pz );
px++; py++; pz++;
}
glEnd();
glEnable(GL_LIGHTING);
glDisable(GL_BLEND);
}
Stafford Goodsell wrote:
> Hi,
>
> 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.
>
> Is it possible to draw using both OpenGL and ssg scenes at the same time?
>
> 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.
> For example:
>
> an object at (0, 0, 0):
> -.
> an object at (0, -2, 5):
> -.
> an object at (0, -4, 0), rotated by (180, 0, 0):
> .-
> .
> the last one should be '- ' if the coordinate systems were the same.
>
> Is this a bug in plib, or some strange 'feature' of OpenGL? I have tried both
> plib 1.0.20, and 1.1.11, and they are the same in this respect. This anomaly
> is giving me much trouble in creating rotations relative to an object (as one
> needs in physics). 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.
>
> Thanks for any help.
>
> --
> Stafford Goodsell <su...@po...> _
> C")
> Programmer, administrator, avid gamer and all-round computer geek (_)
> http://www.marys.dyndns.org/ -"-
>
> _______________________________________________
> plib-users mailing list
> pli...@li...
> http://lists.sourceforge.net/mailman/listinfo/plib-users
--
+-------------------------+--------------------------------------------+
| Landshark (dave) | Visio clone for *nix? It's in the works: |
| lan...@am... | http://queesio.sourceforge.net |
+-------------------------+--------------------------------------------+
| X10 GUI Device Controller for *nix? http://q10.phlan.net |
+----------------------------------------------------------------------+
|