Home > Back-end >  Use OpenGL 3 d graphics, coordinate system and node labeling problems
Use OpenGL 3 d graphics, coordinate system and node labeling problems

Time:09-21

Use OpenGL gluCylinder (GLUquadric * qobj, GLdouble baseRadius, GLdouble topRadius, GLdouble height, GLint slices, GLint sports) to draw cylinder, according to the slices tag node number? How to coordinate axis rotation around the one? How to make the object moving with screen rather than the axis?

CodePudding user response:

Come and help me ah, urgent urgent.

CodePudding user response:

GlClearColor (1.0 f, f, 1.0 1.0 f, 1.0 f);
GlClearStencil (1);
//can make stencil buffer
GlEnable (GL_STENCIL_TEST);
//the whole for the current window cleaning a color: black, clear the depth buffer, stencil buffer
GlClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
//remove color depth buffer and buffer
//glViewport (200-100100, 0100);
GlLineWidth (2.0);
GlColor3f (0.0, 0.0, 1.0);
GluQuadricDrawStyle (cylinder_obj GLU_LINE);
Const GLfloat Pi=3.1415926536 f;
GlHint (GL_LINE_SMOOTH_HINT GL_NICEST);
If (d & gt; 1)
{
GlTranslatef (0.01, 0.0, 0.0);

GluCylinder (cylinder_obj, b/300 a/300,/150 c, e, d - 1);
}
Else if (d==1)
{

GlTranslatef (0.01, 0.0, 0.0);

GlBegin (GL_LINE_LOOP);//thread for graph connection
For (int I=0; I{
GlVertex2f (0.7 * cos (2 * I * Pi/e)/2,0.7 * sin (2 * I * Pi/e)/2);
}
glEnd();

}
GlFinish ();
SwapBuffers (wglGetCurrentDC ());


This is the right code I wrote, but sometimes moves to the right move sideways, sometimes you great god help take a look at how to realize moves to the right is moving on the screen is not affected by the influence of the axis?
  • Related