Quantcast

Got Homework?

Connect with other students for help. It's a free community.

  • across
    MIT Grad Student
    Online now
  • laura*
    Helped 1,000 students
    Online now
  • Hero
    College Math Guru
    Online now

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

annas Group Title

i need help with my code for drawing a 3d cube code is as follows

  • 2 years ago
  • 2 years ago

  • This Question is Closed
  1. annas Group Title
    Best Response
    You've already chosen the best response.
    Medals 3

    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; }

    • 2 years ago
  2. annas Group Title
    Best Response
    You've already chosen the best response.
    Medals 3

    main problem here is that i dont know which one to use glVertex2f(x,y); or glVertex2i(x,y); or glVertex3f(x,y,z);

    • 2 years ago
  3. annas Group Title
    Best Response
    You've already chosen the best response.
    Medals 3

    secondly help me with co-ordinates

    • 2 years ago
  4. annas Group Title
    Best Response
    You've already chosen the best response.
    Medals 3

    i figured it out myself #include<GL/glut.h> 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; }

    • 2 years ago
  5. annas Group Title
    Best Response
    You've already chosen the best response.
    Medals 3

    it'll make a cube like this.

    • 2 years ago
    1 Attachment
  6. karatechopper Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    *quite amused* I dont understand the letters and symbols up there tho. I just see how cool the cube is:)

    • 2 years ago
  7. annas Group Title
    Best Response
    You've already chosen the best response.
    Medals 3

    yup its graphic designing :D

    • 2 years ago
  8. karatechopper Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    I only know how to kinda mix songs together:D i learned it!

    • 2 years ago
  9. annas Group Title
    Best Response
    You've already chosen the best response.
    Medals 3

    awesome :D

    • 2 years ago
    • Attachments:

See more questions >>>

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.