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 9 of 9

Thread: Help with installing the GFLW library :S

  1. #1
    Junior Member Newbie
    Join Date
    Jul 2008
    Posts
    7

    Help with installing the GFLW library :S

    I'm just miserable with this OPENGL libraries.
    Every library that i try to install, I don't succeed.
    I chose to start using OPENGL because I found it interesting and now as the time pass I regret this decision because I don't even manage to install even one of it's libraries -_-.

    I need help from someone that can help me catch up with this things so I can start programming ASAP.

    I read the guide to install the library and I didn't understand what I need to compile!!!

    I want someone to write simple and understandable guide for me how to install this library...I FEEL LOST!!!


    I would be glad if someone will do that.Thanx.

  2. #2
    Senior Member OpenGL Pro Zengar's Avatar
    Join Date
    Sep 2001
    Location
    Germany
    Posts
    1,932

    Re: Help with installing the GFLW library :S

    Well, for starters you should tell us what platform are you working on and what programming language do you use. And GLFW has a very simple and intuitive project structure with all makefiles you need.

  3. #3
    Junior Member Newbie
    Join Date
    Jul 2008
    Posts
    7

    Re: Help with installing the GFLW library :S

    I am writing under Windows using C programming language.
    I did not understand how to install all these libraries :\

  4. #4
    Senior Member OpenGL Pro dletozeun's Avatar
    Join Date
    Jan 2006
    Location
    FRANCE
    Posts
    1,367

    Re: Help with installing the GFLW library :S

    What IDE are you working on? Visual studio ?

    I have really nothing to do to install this library, just copy and paste. All is here. Just download the glfw-2.6.bin.WIN32.zip windows binaries package in the download section and paste the lib and header files in the good directories in your development environment.

  5. #5
    Junior Member Newbie
    Join Date
    Jul 2008
    Posts
    7

    Re: Help with installing the GFLW library :S

    DEV C++

  6. #6
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,580

    Re: Help with installing the GFLW library :S

    I am pretty sure there is a devpack for GLFW in dev-c++, you should be able to easily get through the packages manager integrated with the IDE.

    PS: there it is :
    http://devpaks.org/details.php?devpak=72

  7. #7
    Junior Member Newbie
    Join Date
    Jul 2008
    Posts
    7

    Re: Help with installing the GFLW library :S

    Thanks a lot...I will check this out.

  8. #8
    Junior Member Newbie
    Join Date
    Jul 2008
    Posts
    7

    Re: Help with installing the GFLW library :S

    OK I installed this GLFW package for DEV C++.
    Now I have created a source file with this code:

    #include <stdlib.h> // For malloc() etc.
    #include <stdio.h> // For printf(), fopen() etc.
    #include <math.h> // For sin(), cos() etc.
    #include <GL/glfw.h> // For GLFW, OpenGL and GLU


    //----------------------------------------------------------------------
    // Draw() - Main OpenGL drawing function that is called each frame
    //----------------------------------------------------------------------

    void Draw( void )
    {
    int width, height; // Window dimensions
    double t; // Time (in seconds)

    // Get current time
    t = glfwGetTime();

    // Get window size
    glfwGetWindowSize( &width, &height );

    // Make sure that height is non-zero to avoid division by zero
    height = height < 1 ? 1 : height;

    // Set viewport
    glViewport( 0, 0, width, height );

    // Clear color and depht buffers
    glClearColor( 0.0f, 0.0f, 0.0f, 0.0f );
    glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );

    // Set up projection matrix
    glMatrixMode( GL_PROJECTION ); // Select projection matrix
    glLoadIdentity(); // Start with an identity matrix
    gluPerspective( // Set perspective view
    65.0, // Field of view = 65 degrees
    (double)width/(double)height, // Window aspect (assumes square pixels)
    1.0, // Near Z clipping plane
    100.0 // Far Z clippling plane
    );

    // Set up modelview matrix
    glMatrixMode( GL_MODELVIEW ); // Select modelview matrix
    glLoadIdentity(); // Start with an identity matrix
    gluLookAt( // Set camera position and orientation
    0.0, 0.0, 10.0, // Camera position (x,y,z)
    0.0, 0.0, 0.0, // View point (x,y,z)
    0.0, 1.0, 0.0 // Up-vector (x,y,z)
    );

    // Here is where actual OpenGL rendering calls would begin...
    }


    //----------------------------------------------------------------------
    // main() - Program entry point
    //----------------------------------------------------------------------

    int main( int argc, char **argv )
    {
    int ok; // Flag telling if the window was opened
    int running; // Flag telling if the program is running

    // Initialize GLFW
    glfwInit();

    // Open window
    ok = glfwOpenWindow(
    640, 480, // Width and height of window
    8, 8, 8, // Number of red, green, and blue bits for color buffer
    8, // Number of bits for alpha buffer
    24, // Number of bits for depth buffer (Z-buffer)
    0, // Number of bits for stencil buffer
    GLFW_WINDOW // We want a desktop window (could be GLFW_FULLSCREEN)
    );

    // If we could not open a window, exit now
    if( !ok )
    {
    glfwTerminate();
    return 0;
    }

    // Set window title
    glfwSetWindowTitle( "My OpenGL program" );

    // Enable sticky keys
    glfwEnable( GLFW_STICKY_KEYS );

    // Main rendering loop
    do
    {
    // Call our rendering function
    Draw();

    // Swap front and back buffers (we use a double buffered display)
    glfwSwapBuffers();

    // Check if the escape key was pressed, or if the window was closed
    running = !glfwGetKey( GLFW_KEY_ESC ) &&
    glfwGetWindowParam( GLFW_OPENED );
    }
    while( running );

    // Terminate GLFW
    glfwTerminate();

    // Exit program
    return 0;
    }

    and i get linker error for undefined reference to GLFW functions.
    What is the problem here?

  9. #9
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,580

    Re: Help with installing the GFLW library :S

    You did not forget to add the libs to the linker options, right ?

    -lglfw -lopengl32 -lglu32

    As MinGW is used by dev-c++ for actual compile and link stages, see its section here :
    http://glfw.sourceforge.net/tutorial.../lesson00.html

Posting Permissions

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