PDA

View Full Version : confused about redenring cylinder



beet6
01-23-2002, 07:23 PM
#include <windows.h>
#include <GL/glut.h>


static int R1=0,R2=45.0,R3=0,R4=0,R5=0,R6=0;
GLfloat nearView=-10.0;

void inti(void)
{
glClearColor(0.,0.,0.,0.);
glShadeModel(GL_SMOOTH);
}

void display()
{
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glColor3f(1.0,0.0,0.0);
GLUquadric* pQu;
pQu=gluNewQuadric();
gluQuadricDrawStyle(pQu,GLU_FILL);
gluQuadricNormals(pQu,GLU_SMOOTH);

glTranslatef(0.0,0.0,-10.0);
gluCylinder(pQu,0.5,0.5,1.0,2,1);
glFlush();
}

void reshape(int w, int h)
{
glViewport(0,0,(GLsizei) w,(GLsizei) h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(90.0,(GLfloat)w/(GLfloat)h,1.0,100.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0,0.0,-10.0);
}


int main(int argc, char** argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB|GL_DEPTH) ;
glutInitWindowSize(500,500);
glutInitWindowPosition(100,100);
glutCreateWindow(argv[0]);
inti();
glutDisplayFunc(display);
glutReshapeFunc(reshape);
glutMainLoop();
return 0;
}


Why cannot I render the cylinder? any help is most appreciated!

beet

wedge
01-23-2002, 10:28 PM
please no crossposting .

beet6
01-24-2002, 07:17 AM
pls help me out of question? :P