anonymous
  • anonymous
i need help with my code for drawing a 3d cube code is as follows
Computer Science
  • Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
SOLVED
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
schrodinger
  • schrodinger
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
anonymous
  • anonymous
void display() { glClear(GL_COLOR_BUFFER_BIT); glBegin(GL_LINE_STRIP); glVertex2f(0.01,0.25); glVertex2f(0.3,0.3); glVertex2f(-0.13,0.3); glVertex2f(-0.6,0.263); glVertex2f(-0.654,-0.5); glVertex2f(0.01,-0.5); glVertex2f(0.3,-0.27); glEnd(); glFlush(); } void Color() { glClearColor(0.0, 0.0, 0.0, 0.0); glColor3f(1.0, 1.0, 1.0); } int main(int argc, char** argv) { glutInit(&argc,argv); glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); glutInitWindowSize(500, 500); glutInitWindowPosition(200, 100); glutCreateWindow("cube"); glutDisplayFunc(display); Color(); glutMainLoop(); return 0; }
anonymous
  • anonymous
main problem here is that i dont know which one to use glVertex2f(x,y); or glVertex2i(x,y); or glVertex3f(x,y,z);
anonymous
  • anonymous
secondly help me with co-ordinates

Looking for something else?

Not the answer you are looking for? Search for more explanations.

More answers

anonymous
  • anonymous
i figured it out myself #include void display() { glClear(GL_COLOR_BUFFER_BIT); glRotatef(30,1,1,1); glBegin(GL_QUADS); glColor3f(1,0,0); glVertex3f(-0.5,-0.5,-0.5); glVertex3f( 0.5,-0.5,-0.5); glVertex3f( 0.5, 0.5,-0.5); glVertex3f(-0.5, 0.5,-0.5); glColor3f(0,1,0); glVertex3f(-0.5,-0.5,-0.5); glVertex3f(-0.5,-0.5, 0.5); glVertex3f(-0.5, 0.5, 0.5); glVertex3f(-0.5, 0.5,-0.5); glColor3f(0,0,1); glVertex3f( 0.5,-0.5, 0.5); glVertex3f( 0.5,-0.5,-0.5); glVertex3f( 0.5, 0.5,-0.5); glVertex3f( 0.5, 0.5, 0.5); glColor3f(1,1,0); glVertex3f(-0.5,-0.5,-0.5); glVertex3f( 0.5,-0.5,-0.5); glVertex3f( 0.5,-0.5, 0.5); glVertex3f(-0.5,-0.5, 0.5); glColor3f(0,1,1); glVertex3f(-0.5,-0.5, 0.5); glVertex3f( 0.5,-0.5, 0.5); glVertex3f( 0.5, 0.5, 0.5); glVertex3f(-0.5, 0.5, 0.5); glEnd(); glFlush(); } void Color() { glClearColor(0.0, 0.0, 0.0, 0.0); glColor3f(0.0, 1.0, 1.0); } int main(int argc, char** argv) { glutInit(&argc,argv); glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); glutInitWindowSize(500, 500); glutInitWindowPosition(200, 100); glutCreateWindow("cube"); glutDisplayFunc(display); Color(); glutMainLoop(); return 0; }
anonymous
  • anonymous
it'll make a cube like this.
1 Attachment
karatechopper
  • karatechopper
*quite amused* I dont understand the letters and symbols up there tho. I just see how cool the cube is:)
anonymous
  • anonymous
yup its graphic designing :D
karatechopper
  • karatechopper
I only know how to kinda mix songs together:D i learned it!
anonymous
  • anonymous
awesome :D

Looking for something else?

Not the answer you are looking for? Search for more explanations.