Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: Not sure what im doing wrong, GL/Glew.h and GL/freeglut.h problem

  1. #1
    Newbie Newbie
    Join Date
    Jul 2012
    Posts
    2

    Not sure what im doing wrong, GL/Glew.h and GL/freeglut.h problem

    I use windows 7 and codeblocks





    Code :
    #include <stdlib.h>
    #include <stdio.h>
    #include <string.h>
    #include <GL/glew.h>
    #include <GL/freeglut.h>
    #define WINDOW_TITLE_PREFIX "Chapter 1"
     
    int CurrentWidth = 800,
        CurrentHeight = 600,
        WindowHandle = 0;
     
    void Initialize(int, char*[]);
    void InitWindow(int, char*[]);
    void ResizeFunction(int, int);
    void RenderFunction(void);
     
    int main(int argc, char* argv[])
    {
        Initialize(argc, argv);
     
        glutMainLoop();
     
        exit(EXIT_SUCCESS);
    }
     
    void Initialize(int argc, char* argv[])
    {
        InitWindow(argc, argv);
     
        fprintf(
            stdout,
            "INFO: OpenGL Version: %s\n",
            glGetString(GL_VERSION)
       &nbsp;);
     
        glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
    }
     
    void InitWindow(int argc, char* argv[])
    {
        glutInit(&argc, argv);
     
        glutInitContextVersion(4, 0);
        glutInitContextFlags(GLUT_FORWARD_COMPATIBLE);
        glutInitContextProfile(GLUT_CORE_PROFILE);
     
        glutSetOption(
            GLUT_ACTION_ON_WINDOW_CLOSE,
            GLUT_ACTION_GLUTMAINLOOP_RETURNS
       &nbsp;);
     
        glutInitWindowSize(CurrentWidth, CurrentHeight);
     
        glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);
     
        WindowHandle = glutCreateWindow(WINDOW_TITLE_PREFIX);
     
        if(WindowHandle < 1) {
            fprintf(
                stderr,
                "ERROR: Could not create a new rendering window.\n"
           &nbsp;);
            exit(EXIT_FAILURE);
        }
     
        glutReshapeFunc(ResizeFunction);
        glutDisplayFunc(RenderFunction);
    }
     
    void ResizeFunction(int Width, int Height)
    {
        CurrentWidth = Width;
        CurrentHeight = Height;
        glViewport(0, 0, CurrentWidth, CurrentHeight);
    }
     
    void RenderFunction(void)
    {
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
     
        glutSwapBuffers();
        glutPostRedisplay();
    }
    Main errors:C:\Users\Owner\Desktop\xxx.cpp\xxx\aaa\sdf\Cube_Sp in\main.cpp:4:21: error: GL/glew.h: No such file or directory

    C:\Users\Owner\Desktop\xxx.cpp\xxx\aaa\sdf\Cube_Sp in\main.cpp:5:25: error: GL/freeglut.h: No such file or directory



    I think that if i could fix these everything else would go away. I dont understand what im doing wrong and im a complete begginer with OpenGL.
    Last edited by moonbeamer2234; 07-28-2012 at 10:34 AM.

  2. #2
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    3,188
    Quote Originally Posted by moonbeamer2234 View Post
    Main errors:C:\Users\Owner\Desktop\xxx.cpp\xxx\aaa\sdf\Cube_Sp in\main.cpp:4:21: error: GL/glew.h: No such file or directory

    C:\Users\Owner\Desktop\xxx.cpp\xxx\aaa\sdf\Cube_Sp in\main.cpp:5:25: error: GL/freeglut.h: No such file or directory

    ...I dont understand what im doing wrong and im a complete begginer with OpenGL.
    Looks like you need to install GLEW and FreeGLUT (if not already installed). If you still get these errors after install, you should provide an include path to your compiler to tell it where to look for these header files.

  3. #3
    Newbie Newbie
    Join Date
    Jul 2012
    Posts
    2
    Quote Originally Posted by Dark Photon View Post
    Looks like you need to install GLEW and FreeGLUT (if not already installed). If you still get these errors after install, you should provide an include path to your compiler to tell it where to look for these header files.
    where do i install these?

  4. #4
    Junior Member Newbie
    Join Date
    Jul 2012
    Location
    Virginia, USA
    Posts
    12
    GLEW http://glew.sourceforge.net/
    GLUT http://freeglut.sourceforge.net/index.php#download
    you must put .dll .lib and .h files in appropriate places
    to do that watch this
    http://www.youtube.com/watch?v=TH_hA_Sru6Q

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •