Jimmy Johnson wrote:
> I know this is an openGL question, but the openGL newgroup has very little 
> activity.  I was hoping someone here might be able to shed some light on this 
> problem.
> 
> I am trying to determine how to draw a dot in openGL (for a class project).
> 
> This code will draw a triangle, but why does the for loop not draw a green 
> diagonal line?  What state in openGL would do that?
> 
>   int i;
> //         float c[] = {(float)$r, (float)$g, (float)$b};
>   float c[3];
>   c[0] = 0.0;
>   c[1] = 1.0;
>   c[2] = 0.0;
>   for (i = 1; i < 100; i++) {
>     glRasterPos2i (i, i);
>     glDrawPixels(1, 1, GL_RGB, GL_FLOAT, c);     
>   };
>   glRotatef( 1.0f, 0.0f, 0.0f, 1.0f );
>   glBegin( GL_TRIANGLES );
>     glColor3f( 1.0f, 0.0f, 0.0f ); glVertex2f( 0.0f, 1.0f );
>     glColor3f( 0.0f, 1.0f, 0.0f ); glVertex2f( 0.87f, -0.5f );
>     glColor3f( 0.0f, 0.0f, 1.0f ); glVertex2f( -0.87f, -0.5f );
>   glEnd();
>   glPopMatrix();
> 
> 
> Thanks and best regards,
> 
> Jimmy J. Johnson

I'm not sure, but when working with 3D, it is best to stick to 3D - you 
can supposedly simulate 2D sprites in 3D by taking two triangles to make 
a square/rectangle and then putting the texture on that.  I digress.  A 
quick Google search turned up:

http://www.c-sharpcorner.com/UploadFile/jeradus/OpenGLBasics11172005014307AM/OpenGLBasics.aspx

While that is for C#, it should be easy to translate to C/C++.

-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* MyTaskFocus 1.1
Get on task.  Stay on task.

http://www.CubicleSoft.com/MyTaskFocus/

Reply via email to