OpenGl Version

This is a discussion on OpenGl Version within the Game Programming forums, part of the General Programming Boards category; I'm using Dev c++ and I want check the version of opengl I can use(that would be the gl.h file ...

  1. #1
    Registered User
    Join Date
    Aug 2008
    Posts
    55

    OpenGl Version

    I'm using Dev c++ and I want check the version of opengl I can use(that would be the gl.h file in the include folder for dev c++ right?) through code. I want to print the version text in a window, how exactly would I do this? I was thinking of using messagebox() and glGetString() but I couldn't get it to work. Also, if the version of opengl I'm using it out of date, what are the exact files I would need to get and were would I need to put them? Thanks for any help.

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,417
    I dunno, "I tried x and it didn't work" doesn't help us figure out where you went wrong.
    Post an actual attempt.

    > Also, if the version of opengl I'm using it out of date, what are the exact files I would need to get and were would I need to put them? Thanks for any help.
    Dev-c++ has things called devpaks which contain all you need to install a lib without effort on your part.
    That's not to say that you couldn't figure out how to do it yourself.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User
    Join Date
    Aug 2008
    Posts
    55
    char* version = (char*) glGetString(GL_VERSION);
    messagebox(hWnd, version, "title bar", MB_OK );

  4. #4
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,417
    Ok, I'm bored with trying to get blood out of a stone.
    http://www.catb.org/~esr/faqs/smart-questions.html

    Did it compile?
    Did it link?
    Did you get a message box?
    Did it display garbage or nothing?
    Did messagebox(hWnd, "a fixed string", "title bar", MB_OK ); work and messagebox(hWnd, version, "title bar", MB_OK ); not?

    And so on and so forth.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  5. #5
    Registered User
    Join Date
    Aug 2008
    Posts
    55
    I was really just looking for an example of how something like this might work. The first time I tried the previous example I got an error an thought I must have been way off base, but it magically works today so no problems there anymore. Sorry for being vague.

    As for the devpacks, I would like to get the files and put them where they need to go manually, just to make sure I understand how it works. Is it just the newest gl.h file that I would need to get and put in the include folder to replace the current one or would there be others needed as well?

    glGetString() shows version 2.1.2, but I looked in the gl.h file and it states that it is mesa 3d 4.0 which implements opengl 1.3, so I'm not sure what is going on there.

  6. #6
    The Right Honourable psychopath's Avatar
    Join Date
    Mar 2004
    Location
    Where circles begin.
    Posts
    1,070
    Assuming you're on Windows, the OpenGL library that is shipped (with Windows) is severely out of date. glGetString() will return the GL version implemented by your graphics driver. To actually make use of the features, you'll want to grab glext.h. This file contains prototypes and definitions that you'll need to use to query the driver for the function(s) via wglGetProcAddress().

    From the registry:
    Because extensions vary from platform to platform and driver to driver, OpenGL developers can't expect interfaces for all extensions to be defined in the standard gl.h, glx.h, and wgl.h header files.
    Memorial University of Newfoundland
    Computer Science

    Mac and OpenGL evangelist.

  7. #7
    Registered User
    Join Date
    Apr 2007
    Posts
    102
    Here you go, you can get the latest header files here:
    OpenGL 3.0 Drivers

    These are the latest OpenGL 3.0 API files, so you will definently be up to date (it was only released a few months ago)

    Just manually copy and paste them into your compilers include/gl folder. Then just include glext.h instead of gl.h

    [Edit]Aww wait, forgot to mention, your compiler will complain at first if you only include glext. You will have to include both gl and glext, however I personally modified the glext header to include gl by itself anyway, which worked nicely. So someway you have to include both files. Either way works well.
    Last edited by JJFMJR; 11-26-2008 at 08:18 AM. Reason: Added Comment
    My Favorite Programming Line:
    Code:
    #define true ((rand() % 2) ? true : false)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. OpenGL Quesiton: Does Windows XP, Vista still at OpenGL 1.1?
    By indigo0086 in forum Game Programming
    Replies: 8
    Last Post: 05-21-2007, 11:18 AM
  2. How to set File Version of VC++ 6 dll
    By mercury529 in forum Windows Programming
    Replies: 3
    Last Post: 12-08-2006, 01:49 PM
  3. first opengl game, problems.
    By n3v in forum Game Programming
    Replies: 1
    Last Post: 07-11-2006, 08:22 PM
  4. OpenGL .dll vs video card dll
    By Silvercord in forum Game Programming
    Replies: 14
    Last Post: 02-12-2003, 06:57 PM
  5. MISC questions about OpenGL
    By Silvercord in forum Game Programming
    Replies: 12
    Last Post: 01-25-2003, 03:20 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21