Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: OpenGL libraries linking

  1. #1
    Guest

    OpenGL libraries linking

    Why should we link OpenGL libraries? I am using Visual C++ 6.0, I was told to inlcude OpenGL32.lib GLu32.lib glut32.lib into Project/Settings.

    But, my program works fine even without including of those libraries. What happen? What is the different if I were to link the libraries and without linking it?

  2. #2
    Junior Member Regular Contributor
    Join Date
    Jun 2004
    Location
    mexico
    Posts
    127

    Re: OpenGL libraries linking

    maybe you are including them using #pragma comment(lib,"opengl32.lib"); or maybe you are not using the opengl functions

  3. #3
    Guest

    Re: OpenGL libraries linking

    I never include #pragma (I don't know what it is as well), and I am using pure OpenGL function, just really confuse.

    I program OpenGL using Window Console Application, after I have compiled and build the file, I go to my Project Settings/Link, the libraries shown are:

    kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib

    As you may see, the program works fine even without including any OpenGL libraries. Or may it be the case where the OpenGL libraries are included once, and need not to be included at the subsequent time?

    I just want to know whether you all include those OpenGL libraries 'each time' you create a new project, or incluce it once, and no need to include it again next time when creating a new project? Or OpenGL libraries are not necessary for console application?

  4. #4
    Member Regular Contributor
    Join Date
    Aug 2003
    Posts
    368

    Re: OpenGL libraries linking

    Someone correct me if I'm wrong, but the libraries is what ties the executables with your source code. You're calling a library function, any function. The compiler will need the library file so it can find the address of the function in the dll file. My guess is that the compiler you're using knows where to find the .lib's
    A couple of years ago when I started learning OpenGL this thing had me fumbled for 4 days, as I used an glaux function and my project could not link to the auxiliary library.
    In the end, know that the thing happens, even if it is done automatically, and you don't know about it.
    PS At least you know what to do if your compiler start spitting link errors

  5. #5
    Guest

    Re: OpenGL libraries linking

    I agree with you too. If any one who have better solution, just hope that you guys may share it here. I think my question is slightly out of OpenGL topic, however, as we are programming in OpenGL, we need to know some lower-end implementation especially for debugging purpose, right?

    Meanwhile, I am looking for this answer too, if I manage to get the answer, and I will share it over here.

  6. #6
    Junior Member Regular Contributor
    Join Date
    Jun 2004
    Location
    mexico
    Posts
    127

    Re: OpenGL libraries linking

    on your main() function write glLoadIdentity();
    then compile and link, if it does it without any errors please tell me

  7. #7
    Guest

    Re: OpenGL libraries linking

    Is this what you mean:

    Code :
      void main()
    {
    	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
    	glutInitWindowSize(400, 400);
    	glutCreateWindow("libLinking");
    	glutDisplayFunc(RenderScene);
    	glutReshapeFunc(Reshape);
     
    	glLoadIdentity();
     
    	setupRC();
     
    	glutMainLoop();
    }
    If this is the code, then my IDE generate no error on it.

  8. #8
    Guest

    Re: OpenGL libraries linking

    I will not reply by today if I am buzy because I am rushing my OpenGL assignment and for another two hours more, it is the assignment deadline. What make ridiculous is that there is one last part remaining, that is I don't know how to transform a straight line to a curve line upon animation.

    I know it is not fair to me ask for help for my assignment, but I just want to know is there any OpenGL API function which can transform straight line to a curve line? glTranslate? glScale?

    For library linking issues, I hope that we can discuss further later. Now my time here is 05:14am

  9. #9
    Junior Member Regular Contributor
    Join Date
    Jun 2004
    Location
    mexico
    Posts
    127

    Re: OpenGL libraries linking

    1) you are using glut
    2) i dont have the least idea why it doesnt have errors
    3) for your assignment, use a line strip, then gradualy move on the X or Y axis the vertex points to start generating a curve

  10. #10
    Senior Member OpenGL Pro
    Join Date
    May 2001
    Location
    Kristianstad,Skåne,Sweden
    Posts
    1,651

    Re: OpenGL libraries linking

    If you are allowed to use glu functions you could also create a spline/nurbs curve, then you can simply transform the line to a curve by moving the control handles for the curve.

    Mikael

Posting Permissions

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