Sign in to follow this  
jakesee

OpenGL Understanding OpenGL ... again

Recommended Posts

jakesee    100
Hi,

I have been playing with opengl for a 2 years now. So far, I have been using the following files:

gl.h, glu.h, opengl32.lib, glu.lib

I read a bunch of articles on opengl.org and some other places but still don't fully understand how to get the lastest opengl. Hope someone can verify what I know (pertaining to windows for a start):

1. Windows never updates gl.h (but why would the others do so?)
2. New features in later versions of opengl are declared in glext.h i.e. this file keeps growing bigger.
3. glext.h contains all declarations of every single vendor's routine for every opengl specification.
4. opengl32.lib /opengl32.dll is the combined compiled binary of glext.h and gl.h
5. glew.h/glew.lib provides the functions to determine if a specific glext function is available on the current host/GPU.
6. glee is just a less popular glew?
7. when a routine in opengl32.dll is run, it loads and runs the graphics card's driver.dll which will always be the latest opengl.
8. hence, wglCreateContext() always creates the lastest context?

I am sure I didn't quite get that right.. please correct me. Thanks.

Share this post


Link to post
Share on other sites
Krohm    5031
I'm not up to date with latest GL so I want to share my opinions to have a double check with other users as well. Take this with some salt.
Quote:
Original post by jakesee
1. Windows never updates gl.h (but why would the others do so?)
You must think this question in reverse. A good OS will sooner or later get its gl.h updated as this is the right way to do things. Windows does not update it because it considers GL a legacy API to be deprecated. This is awful, but D3D is fairly good and they'll use all the ways they can to get you into it.
Quote:
Original post by jakesee
2. New features in later versions of opengl are declared in glext.h i.e. this file keeps growing bigger.
Correct. It will never get smaller as this would break something (which is likely already broken anyway). So much for 15+ year compatibility.
This is probably GL's biggest drawback. Old stuff never really goes away.
Quote:
Original post by jakesee
3. glext.h contains all declarations of every single vendor's routine for every opengl specification.
Not quite. Most of the time, the routine you're looking for "is there" but sometimes you might have to declare your own pointers.
Quote:
Original post by jakesee
4. opengl32.lib /opengl32.dll is the combined compiled binary of glext.h and gl.h
No. Not in general at least. Just update your glext.h and this statement becomes false. This is probably partially true out of the box. The question is a bit odd as header files don't have to produce code - I am unsure right now if GL's headers would produce code, I think not. The DLL is likely to contain fairly more stuff, at least to implement all the functions which are only "declared" as function pointers in glext.h.

I cannot tell about {5} and {6}.

Quote:
Original post by jakesee
7. when a routine in opengl32.dll is run, it loads and runs the graphics card's driver.dll which will always be the latest opengl.
More or less. Let's say yes by cutting some corners.
Quote:
Original post by jakesee
8. hence, wglCreateContext() always creates the lastest context?
Sort of. It will create the best context it can figure out, but its logic is defined in WGL's static lib so for example you cannot have antialiasing. This is why you need stuff as WGL_ARB_create_context, WGL_ARB_create_context_profile, WGL_ARB_create_context_robustness...

Share this post


Link to post
Share on other sites
owl    376
To make it short: Yes. You'll have to rip your ass and study WTF is going on with the "last" version of OpenGL when you just installed XP/Vista/7.

But hey! Millions of Linux users would be willing to pay you big bucks for your effort. So it's worth it as a way of saving money for your retirement.

Share this post


Link to post
Share on other sites
jakesee    100
@Krohm
Thanks for the explainations and confirmations.

There's still one issue, regarding whether Windows should update gl.h.

General impression I gather is that Microsoft is to blame for not updating gl.h. However, if the opengl standard is to provide additional functionality through "extensions" in the glext.h, why would there be a need to update gl.h? That's what I don't understand.

Any reason why they wouldn't name the gl according to version number?


// gl.h (provided by OS)
#pragma comment("lib", "opengl32.lib") // lastest lib provided by OS
...

// gl2.h (download from opengl.org repository)
#include <gl/gl.h>
...

// gl3.h (download from opengl.org repository)
#include <gl/gl2.h>
...

// etc..

Share this post


Link to post
Share on other sites
JackTheRapper    150
The OGL headers are declarations, not definitions. Whether gl.h contains declarations for version 1.0 or 4.0 is immaterial as once new extensions are available you'll have to either make the additional declarations yourself or download a newer header. IIRC opengl32.dll (and the accompanying .lib) contain Microsoft's software implementation of OGL 1.1 (and most likely all the wiggle stuff). The actual hardware accelerated implementation will be provided by the gfx vendor's driver. This is why you need to query extensions to ensure that your vendor provides an implementation for whatever features you desire.

I think you're getting the header declarations that come bundled with MS's compilers (gl.h) with the actual implementation of whatever version of OGL is supported by the gfx vendor. Why don't MS update the headers? Well, for starters they back their own propriety gfx API but also because there's an existing repository for such things @ opengl.org, as well as various extension management libs (GLEE, GLEW, etc.)

Share this post


Link to post
Share on other sites
V-man    813
Quote:
Original post by jakesee
Hi,

I have been playing with opengl for a 2 years now. So far, I have been using the following files:

gl.h, glu.h, opengl32.lib, glu.lib

I read a bunch of articles on opengl.org and some other places but still don't fully understand how to get the lastest opengl. Hope someone can verify what I know (pertaining to windows for a start):

1. Windows never updates gl.h (but why would the others do so?)
2. New features in later versions of opengl are declared in glext.h i.e. this file keeps growing bigger.
3. glext.h contains all declarations of every single vendor's routine for every opengl specification.
4. opengl32.lib /opengl32.dll is the combined compiled binary of glext.h and gl.h
5. glew.h/glew.lib provides the functions to determine if a specific glext function is available on the current host/GPU.
6. glee is just a less popular glew?
7. when a routine in opengl32.dll is run, it loads and runs the graphics card's driver.dll which will always be the latest opengl.
8. hence, wglCreateContext() always creates the lastest context?

I am sure I didn't quite get that right.. please correct me. Thanks.


All that is explained in the Wiki at www.opengl.org/wiki
but I'll make clarifications.

1. yes, that's correct, but it doesn't matter. The ARB gives us glext.h and these days they give us gl3.h

3. glext.h also contains new core GL functions. These are not extensions.

4. no. they have nothing to do with glext.h
opengl32.dll comes with Windows and is almost never changed. I believe it offers GL 1.4 with Vista and 7 but this doesn't matter. It doesn't matter because it is not a true device driver. The true device driver would be ati...dll or nvogl....dll or intelGFX.....dll
which opengl32.dll loads automatically.

5. yes
6. Perhaps. I use glew because I prefer to call glewInit(). I don't like GLEE's automatic shit.

7. Yup, you get GL 2.1
WGL_ARB_create_context is for making GL 3.0, 3.1, 3.2, etc.

8. For simplicity, let's say yes

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Similar Content

    • By pseudomarvin
      I assumed that if a shader is computationally expensive then the execution is just slower. But running the following GLSL FS instead just crashes
      void main() { float x = 0; float y = 0; int sum = 0; for (float x = 0; x < 10; x += 0.00005) { for (float y = 0; y < 10; y += 0.00005) { sum++; } } fragColor = vec4(1, 1, 1 , 1.0); } with unhandled exception in nvoglv32.dll. Are there any hard limits on the number of steps/time that a shader can take before it is shut down? I was thinking about implementing some time intensive computation in shaders where it would take on the order of seconds to compute a frame, is that possible? Thanks.
    • By Arulbabu Donbosco
      There are studios selling applications which is just copying any 3Dgraphic content and regenerating into another new window. especially for CAVE Virtual reality experience. so that the user opens REvite or CAD or any other 3D applications and opens a model. then when the user selects the rendered window the VR application copies the 3D model information from the OpenGL window. 
      I got the clue that the VR application replaces the windows opengl32.dll file. how this is possible ... how can we copy the 3d content from the current OpenGL window.
      anyone, please help me .. how to go further... to create an application like VR CAVE. 
       
      Thanks
    • By cebugdev
      hi all,

      i am trying to build an OpenGL 2D GUI system, (yeah yeah, i know i should not be re inventing the wheel, but this is for educational and some other purpose only),
      i have built GUI system before using 2D systems such as that of HTML/JS canvas, but in 2D system, i can directly match a mouse coordinates to the actual graphic coordinates with additional computation for screen size/ratio/scale ofcourse.
      now i want to port it to OpenGL, i know that to render a 2D object in OpenGL we specify coordiantes in Clip space or use the orthographic projection, now heres what i need help about.
      1. what is the right way of rendering the GUI? is it thru drawing in clip space or switching to ortho projection?
      2. from screen coordinates (top left is 0,0 nd bottom right is width height), how can i map the mouse coordinates to OpenGL 2D so that mouse events such as button click works? In consideration ofcourse to the current screen/size dimension.
      3. when let say if the screen size/dimension is different, how to handle this? in my previous javascript 2D engine using canvas, i just have my working coordinates and then just perform the bitblk or copying my working canvas to screen canvas and scale the mouse coordinates from there, in OpenGL how to work on a multiple screen sizes (more like an OpenGL ES question).
      lastly, if you guys know any books, resources, links or tutorials that handle or discuss this, i found one with marekknows opengl game engine website but its not free,
      Just let me know. Did not have any luck finding resource in google for writing our own OpenGL GUI framework.
      IF there are no any available online, just let me know, what things do i need to look into for OpenGL and i will study them one by one to make it work.
      thank you, and looking forward to positive replies.
    • By fllwr0491
      I have a few beginner questions about tesselation that I really have no clue.
      The opengl wiki doesn't seem to talk anything about the details.
       
      What is the relationship between TCS layout out and TES layout in?
      How does the tesselator know how control points are organized?
          e.g. If TES input requests triangles, but TCS can output N vertices.
             What happens in this case?
      In this article,
      http://www.informit.com/articles/article.aspx?p=2120983
      the isoline example TCS out=4, but TES in=isoline.
      And gl_TessCoord is only a single one.
      So which ones are the control points?
      How are tesselator building primitives?
    • By Orella
      I've been developing a 2D Engine using SFML + ImGui.
      Here you can see an image
      The editor is rendered using ImGui and the scene window is a sf::RenderTexture where I draw the GameObjects and then is converted to ImGui::Image to render it in the editor.
      Now I need to create a 3D Engine during this year in my Bachelor Degree but using SDL2 + ImGui and I want to recreate what I did with the 2D Engine. 
      I've managed to render the editor like I did in the 2D Engine using this example that comes with ImGui. 
      3D Editor preview
      But I don't know how to create an equivalent of sf::RenderTexture in SDL2, so I can draw the 3D scene there and convert it to ImGui::Image to show it in the editor.
      If you can provide code will be better. And if you want me to provide any specific code tell me.
      Thanks!
  • Popular Now