From: Jason M. <ko...@gm...> - 2008-09-13 20:07:53
|
OK, so I've finished with the parsing work. I can gather up a list of enums and extension entrypoints for GL, WGL, and GLX. I even have some preliminary code generation scripts. But, as I started actually generating code, I came to realize that there are larger questions that we should probably discuss before I take an action. Here is my plan for how GLE will work from a user perspective. The API will provide this interface function: gleLoadFunctions(GLint majorVersion, GLint minorVersion); This will load all functions and extensions up to the given GL version. It will work similarly to the way ARB_create_context is specified to do. That is, if the version given is 2.1 or less, it will load whatever extensions and functions it can up to version 2.1. This includes the core extensions released with 3.0. If the version is 3.0 or greater, it will load exactly and only that version and whatever extensions apply to it. Giving it the wrong version for the current GL context (2.1 context but 3.0 loading) then this function will return an error. We will provide headers that expose enums and entrypoints, but they will be versioned. There will be a 2.1 header that exposes 2.1 appropriate functions and enums, and there will be a 3.0 version. When 3.1 comes out, there will be a version for that too which is separate from the others. If the ARB decides to release a new version that is backwards compatible with the old one, (if they decide not to remove the deprecated features in 3.0 for the 3.1 release) then we will still have separate headers, but one can simply #include the other. This all does not mean that headers from one version cannot be used with another version. For example, if 3.1 does remove the deprecated features, you can still use the 3.0 headers; what matters is what context you create and what version you pass to gleLoadFunctions. BTW, I call it "load functions" rather than "load extensions" for marketing reasons. Since you have to use this just to use any modern GL version, it sounds silly to a GL newbie to call these things "extensions." Speaking of context creation, I don't know how it works in GLX, but WGL creates a certain stress on the creation of contexts. Often, when making a GL context, you want to create a fake context just so that you can get access to wglGetExtensionsStringARB and load the WGL extensions. Because of that, it is useful to have the following function: gleLoadWinFunctions(); This loads only the WGL/GLX extensions. It requires a valid GL context, but you can destroy that context afterwards and the WGL/GLX functions should still be available. The API will also provide global variables, one per extension, which will be 0 if the extension is not available and 1 if it is. These variables will only be viable if one of the two load function calls has been made. The structure of the headers will look like this: gle_2_1.h gle_3_0.h gle_wgl.h gle_glx.h gle_main.h The first two headers are for the core GL enums and functions. The next two are for WGL/GLX enums and functions. gle_main.h is where gleLoadFunctions and gleLoadWinFunctions is defined. Any header that contains enums and functions will also define the global variables that one uses to tell whether the extension is available, but only for those extensions that it has. |
From: Branan R. <br...@gm...> - 2008-09-15 04:16:14
|
Shouldn't the extension string returned by the GL only include the extensions for the context version anyway? Is there really a need to set the version twice? (Once for context and once for extensions) GLX supports extensions natively. You don't need a context to see what extensions are available, or to get the GLX entrypoints, IIRC. On Sat, Sep 13, 2008 at 1:08 PM, Jason McKesson <ko...@gm...> wrote: > OK, so I've finished with the parsing work. I can gather up a list of > enums and extension entrypoints for GL, WGL, and GLX. I even have some > preliminary code generation scripts. > > But, as I started actually generating code, I came to realize that there > are larger questions that we should probably discuss before I take an > action. > > Here is my plan for how GLE will work from a user perspective. > > The API will provide this interface function: > > gleLoadFunctions(GLint majorVersion, GLint minorVersion); > > This will load all functions and extensions up to the given GL version. > It will work similarly to the way ARB_create_context is specified to do. > That is, if the version given is 2.1 or less, it will load whatever > extensions and functions it can up to version 2.1. This includes the > core extensions released with 3.0. If the version is 3.0 or greater, it > will load exactly and only that version and whatever extensions apply to > it. Giving it the wrong version for the current GL context (2.1 context > but 3.0 loading) then this function will return an error. > > We will provide headers that expose enums and entrypoints, but they will > be versioned. There will be a 2.1 header that exposes 2.1 appropriate > functions and enums, and there will be a 3.0 version. When 3.1 comes > out, there will be a version for that too which is separate from the > others. > > If the ARB decides to release a new version that is backwards compatible > with the old one, (if they decide not to remove the deprecated features > in 3.0 for the 3.1 release) then we will still have separate headers, > but one can simply #include the other. > > This all does not mean that headers from one version cannot be used with > another version. For example, if 3.1 does remove the deprecated > features, you can still use the 3.0 headers; what matters is what > context you create and what version you pass to gleLoadFunctions. > > BTW, I call it "load functions" rather than "load extensions" for > marketing reasons. Since you have to use this just to use any modern GL > version, it sounds silly to a GL newbie to call these things "extensions." > > Speaking of context creation, I don't know how it works in GLX, but WGL > creates a certain stress on the creation of contexts. Often, when making > a GL context, you want to create a fake context just so that you can get > access to wglGetExtensionsStringARB and load the WGL extensions. > > Because of that, it is useful to have the following function: > > gleLoadWinFunctions(); > > This loads only the WGL/GLX extensions. It requires a valid GL context, > but you can destroy that context afterwards and the WGL/GLX functions > should still be available. > > The API will also provide global variables, one per extension, which > will be 0 if the extension is not available and 1 if it is. These > variables will only be viable if one of the two load function calls has > been made. > > The structure of the headers will look like this: > > gle_2_1.h > gle_3_0.h > gle_wgl.h > gle_glx.h > gle_main.h > > The first two headers are for the core GL enums and functions. The next > two are for WGL/GLX enums and functions. gle_main.h is where > gleLoadFunctions and gleLoadWinFunctions is defined. Any header that > contains enums and functions will also define the global variables that > one uses to tell whether the extension is available, but only for those > extensions that it has. > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's > challenge > Build the coolest Linux based applications with Moblin SDK & win great > prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > |
From: Camilla B. <cam...@gm...> - 2008-09-15 17:44:44
|
Branan Riley wrote: > GLX supports extensions natively. You don't need a context to see what > extensions are available, or to get the GLX entrypoints, IIRC. GLX extensions are not the same as OpenGL extensions. It doesn't make any sense to retrieve GL extensions without a context, as at that point the renderer hasn't been chosen yet. By the way, why not layer GLE on top of GLFW? Regards, elmindreda |
From: Jason M. <ko...@gm...> - 2008-09-15 18:44:56
|
On Mon, Sep 15, 2008 at 10:44 AM, Camilla Berglund < cam...@gm...> wrote: > Branan Riley wrote: > > GLX supports extensions natively. You don't need a context to see what > > extensions are available, or to get the GLX entrypoints, IIRC. > > GLX extensions are not the same as OpenGL extensions. It doesn't make > any sense to retrieve GL extensions without a context, as at that > point the renderer hasn't been chosen yet. > > By the way, why not layer GLE on top of GLFW? What exactly do you mean by layering GLE on top of GLFW? Do you mean that GLE should be called by GLFW? I don't think that's such a good idea. I would like GLE to be something that can be used regardless of how one creates a context. Now, it's OK if GLFW called GLE on its own, but GLE should be exposed to the user in case they want to do special context creation stuff. |
From: StApostol <sta...@gm...> - 2008-09-27 21:55:21
|
> I suppose we can determine the version automatically, by checking what the context says. Note that this can be somewhat tricky. For example, most Linux drivers report versions like "1.4 (Mesa 2.1)" - first is GLX, followed by OpenGL. > gleLoadFunctions(GLint majorVersion, GLint minorVersion); > This will load all functions and extensions up to the given GL version. What about non-core functions? Things like ARB, EXT, etc. > > By the way, why not layer GLE on top of GLFW? > What exactly do you mean by layering GLE on top of GLFW? Do you mean that GLE should be called by GLFW? I don't think that's such a good idea. The other way round: have GLE call glfwGetAddress to simplify things. Note that this should work even if the context was *not* created through GLFW. |
From: Camilla B. <cam...@gm...> - 2008-09-28 12:43:18
|
StApostol wrote: >> I suppose we can determine the version automatically, by checking what the >> context says. > > Note that this can be somewhat tricky. For example, most Linux drivers > report versions like "1.4 (Mesa 2.1)" - first is GLX, followed by OpenGL. Actually, the first is OpenGL and the second is the Mesa library, analogous to other platforms. If some distro does it otherwise, it's violating the GL spec (section 6.1.11, "Pointer and String Queries"). >> > By the way, why not layer GLE on top of GLFW? > >> What exactly do you mean by layering GLE on top of GLFW? Do you mean that >> GLE should be called by GLFW? I don't think that's such a good idea. > > The other way round: have GLE call glfwGetAddress to simplify things. Note > that this should work even if the context was *not* created through GLFW. No, it won't. GLFW doesn't allow that call unless it owns the context. Regards, elmindreda |
From: StApostol <sta...@gm...> - 2008-09-28 21:23:45
|
On Sun, Sep 28, 2008 at 3:43 PM, Camilla Berglund < cam...@gm...> wrote: > StApostol wrote: > >> I suppose we can determine the version automatically, by checking what > the > >> context says. > > > > Note that this can be somewhat tricky. For example, most Linux drivers > > report versions like "1.4 (Mesa 2.1)" - first is GLX, followed by OpenGL. > > Actually, the first is OpenGL and the second is the Mesa library, > analogous to other platforms. If some distro does it otherwise, it's > violating the GL spec (section 6.1.11, "Pointer and String Queries"). I stand corrected. Just checked Mesa and the version string is "2.1 Mesa 7.0.3". I am positive that Mesa 6.x returned a string in a different format (because I had to fix my naive parser), but I don't have a distro at hand to check. > > > >> > By the way, why not layer GLE on top of GLFW? > > > >> What exactly do you mean by layering GLE on top of GLFW? Do you mean > that > >> GLE should be called by GLFW? I don't think that's such a good idea. > > > > The other way round: have GLE call glfwGetAddress to simplify things. > Note > > that this should work even if the context was *not* created through GLFW. > > No, it won't. GLFW doesn't allow that call unless it owns the context. Really? All I can think is why was it implemented like this? As long as [wgl/glx/agl]GetCurrentContext returns something, [wgl/glx/agl]GetAddress should be safe to call. Ah, anyway, glfwGetAddress should be simple enough to reimplement. |
From: Camilla B. <cam...@gm...> - 2008-09-29 20:31:48
|
StApostol wrote: >> No, it won't. GLFW doesn't allow that call unless it owns the context. > > Really? All I can think is why was it implemented like this? As long as > [wgl/glx/agl]GetCurrentContext returns something, [wgl/glx/agl]GetAddress > should be safe to call. Yup, it should. I would assume it was because no one thought of it being used that way (it was before my time). I guess I could change it if you want to call it that way. Regards, elmindreda |
From: Jason M. <ko...@gm...> - 2008-10-04 22:05:54
|
Camilla Berglund wrote: > StApostol wrote: > >>> No, it won't. GLFW doesn't allow that call unless it owns the context. >>> >> Really? All I can think is why was it implemented like this? As long as >> [wgl/glx/agl]GetCurrentContext returns something, [wgl/glx/agl]GetAddress >> should be safe to call. >> > > Yup, it should. I would assume it was because no one thought of it > being used that way (it was before my time). I guess I could change > it if you want to call it that way. > > Regards, > elmindreda I don't know why I'm getting all of these e-mails now, but it would be useful to have a GetAddress function that someone who actually can use non-Windows platforms can assure me actually works. So yes, it wouldn't be a bad idea to call glfwGetAddress, if it could be called from an arbitrary GL context. |
From: Jason M. <ko...@gm...> - 2008-09-27 23:00:03
|
StApostol wrote: > > > I suppose we can determine the version automatically, by checking > what the context says. > > Note that this can be somewhat tricky. For example, most Linux drivers > report versions like "1.4 (Mesa 2.1)" - first is GLX, followed by OpenGL. > Then they should be changed. The OpenGL Specification is very clear on this matter: [spec] The VERSION and SHADING LANGUAGE VERSION strings are laid out as follows: <version number><space><vendor-specific information> The version number is either of the form major number.minor number or major number.minor number.release number, where the numbers all have one or more digits. The release number and vendor specific information are optional. However, if present, then they pertain to the server and their format and contents are implementation dependent. GetString returns the version number (in the VERSION string) and the extension names (in the EXTENSIONS string) that can be supported by the current GL context. Thus, if the client and server support different versions and/or extensions, a compatible version and list of extensions is returned. [/spec] If they aren't following that, then that's a problem with most Linux drivers. > > > gleLoadFunctions(GLint majorVersion, GLint minorVersion); > > > This will load all functions and extensions up to the given GL version. > > What about non-core functions? Things like ARB, EXT, etc. > "will load all functions and extensions". That includes extensions. > > > > By the way, why not layer GLE on top of GLFW? > > > What exactly do you mean by layering GLE on top of GLFW? Do you mean > that GLE should be called by GLFW? I don't think that's such a good idea. > > The other way round: have GLE call glfwGetAddress to simplify things. > Note that this should work even if the context was *not* created > through GLFW. > That's not a terrible idea, but I would be hesitant to make GLE dependent on GLFW. Even in that small way. It would be better to bring the glfwGetAddress function into GLE itself. |
From: Stefanos A. <sta...@gm...> - 2008-10-05 21:54:24
|
> > > > > gleLoadFunctions(GLint majorVersion, GLint minorVersion); > > > > > This will load all functions and extensions up to the given GL version. > > > > What about non-core functions? Things like ARB, EXT, etc. > > > "will load all functions and extensions". That includes extensions. > > Have you found any reliable way to group extensions by version? Looking at the gl.spec, many interesting extensions miss the "version" directive... |
From: Jason M. <ko...@gm...> - 2008-09-15 18:41:12
|
On Sun, Sep 14, 2008 at 9:16 PM, Branan Riley <br...@gm...> wrote: > Shouldn't the extension string returned by the GL only include the > extensions for the context version anyway? Is there really a need to set the > version twice? (Once for context and once for extensions) > > GLX supports extensions natively. You don't need a context to see what > extensions are available, or to get the GLX entrypoints, IIRC. > I suppose we can determine the version automatically, by checking what the context says. And we can say that gleLoadWinFunctions() needs a valid context only in Win32. |
From: Jason M. <ko...@gm...> - 2008-10-05 22:30:49
|
Stefanos A. wrote: >>>> gleLoadFunctions(GLint majorVersion, GLint minorVersion); >>>> >>>> This will load all functions and extensions up to the given GL version. >>>> >>> What about non-core functions? Things like ARB, EXT, etc. >>> >>> >> "will load all functions and extensions". That includes extensions. >> > > Have you found any reliable way to group extensions by version? Looking > at the gl.spec, many interesting extensions miss the "version" > directive... I'm not sure that there is a need to group extensions by version. Either the extension is in the extension string or it is not. If it is supported, then it is supported and you can use it. And if it's not supported, then its not supported and you can't use it. It's up to the IHVs to not expose inappropriate extensions (extensions that don't make sense with a particular version). |
From: Stefanos A. <sta...@gm...> - 2008-10-06 10:06:23
|
On Sun, 2008-10-05 at 15:31 -0700, Jason McKesson wrote: > Stefanos A. wrote: > >>>> gleLoadFunctions(GLint majorVersion, GLint minorVersion); > >>>> > >>>> This will load all functions and extensions up to the given GL version. > >>>> > >>> What about non-core functions? Things like ARB, EXT, etc. > >>> > >>> > >> "will load all functions and extensions". That includes extensions. > >> > > > > Have you found any reliable way to group extensions by version? Looking > > at the gl.spec, many interesting extensions miss the "version" > > directive... > I'm not sure that there is a need to group extensions by version. Either > the extension is in the extension string or it is not. If it is > supported, then it is supported and you can use it. And if it's not > supported, then its not supported and you can't use it. It's up to the > IHVs to not expose inappropriate extensions (extensions that don't make > sense with a particular version). > Makes sense, grouping provides no benefit here. BTW, I've had some users mention that they were able to load and use specific extensions, even when they were not present in the extension string (nvidia hardware, old drivers). Anyone knows what's the matter with that? |