Results 1 to 2 of 2

Thread: errors

  1. #1
    Newbie Newbie
    Join Date
    Nov 2013
    Posts
    1

    errors

    I used this code in the "OpenGL Programming Guide Sixth Edition," and it keeps telling me that things such as glutWireSphere() and glutSwapBuffers don't exist, can somebody help me?
    code:

    #include <iostream> //first line of script
    #include <GL/gl.h>
    #include <GL/glu.h>
    #include <unistd.h>
    #include <stdlib.h>

    using namespace std;

    static int year = 0, day = 0;

    void init(void)
    {
    glClearColor(0.0, 0.0, 0.0, 0.0);
    glShadeModel(GL_FLAT);
    }

    void display(void)
    {
    glClear(GL_COLOR_BUFFER_BIT);
    glColor3f(1.0,1.0,1.0);

    glPushMatrix();
    glutWireSphere(1.0,20,16); //sun
    glRotatef((GLfloat)year, 0.0,1.0,0.0);
    glTranslatef(2.0,0.0,0.0);
    glRotatef((GLfloat)day, 0.0, 1.0, 0.0);
    glutWireSphere(0.2,10,; //planet
    glPopMatrix();
    glutSwapBuffers();
    }

    void reshape(int w, int h)
    {
    glViewport(0,0,(GLsizei)w,(GLsizei)h);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    gluPerspective(60.0,(GLfloat)w/(GLfloat) h,1.0,20.0);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    gluLookAt(0.0,0.0,5.0,0.0,0.0,0.0,0.0,1.0,0.0);
    }

    void keyboard(unsigned char key, int x, int y)
    {
    switch(key) {
    case 'd':
    day = (day +10)%360;
    glutPostRedisplay();
    break;
    case'D':
    day = (day - 10) % 360;
    glutPostRedisplay();
    break;
    case 'y':
    year = (year+5)%360;
    glutPostRedisplay();
    break;
    case 'Y':
    year = (year-5)%360;
    glutPostRedisplay();
    break;
    default:
    break;
    }
    }

    int main(int argc, char** argv)
    {
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
    glutInitWindowSize(500,500);
    glutInitWindowPosition(100,100);
    glutCreateWindow(argv[0]);
    init();
    glutDisplayFunc(display);
    glutReshapeFunc(reshape);
    glutKeyboardFunc(keyboard);
    glutMainLoop();
    return 0;
    }//end of script

    p.s: I am using Ubuntu Linux & CodeBlocks

  2. #2
    Senior Member Frequent Contributor ehsan2004's Avatar
    Join Date
    Jun 2004
    Location
    Iran
    Posts
    645
    you should include glut.h as well.

Similar Threads

  1. Xsd.exe errors?
    By pekkah in forum COLLADA
    Replies: 22
    Last Post: 09-12-2008, 04:55 PM
  2. Replies: 0
    Last Post: 11-09-2005, 10:24 PM
  3. errors in gl.h lib
    By in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 01-13-2005, 10:55 AM
  4. errors...
    By Vincent_dup1 in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 06-28-2004, 03:36 PM
  5. Some new errors
    By in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 04-10-2002, 04:18 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean