Inertia's picture

OpenGL 3.0 bindings

Project:The Open Toolkit library
Version:0.9.6
Component:Code
Category:feature request
Priority:normal
Assigned:the Fiddler
Status:closed
Description

Ati has done its homework and over half of the GL 3.0 extensions are supported.

This feature request does not cover forward compatible contexts. No remarks about deprecation either.

I'd really like to see this going in 0.9.2, so we have all gremlins hunted down by the time 0.9.3 is due.


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
kanato's picture

#31

I just tested this on my ATI Radeon 4650 system, and it creates a GL3 context and then crashes on GL.GetString. It looks like this issue: http://www.geeks3d.com/?p=3190

Inertia's picture

#32

I've got the very same problem with Radeon 3870, glGetString crashes with an access violation. GL2.1 is unaffected.

Dear Ati, thanks for sparing us the Catalyst 9.0 experience. ;)

pokemoen's picture

#33

Just tested the gl3 branch with catalyst 9.1 on a HD 3800 series on windows xp sp3.

Encountered the same problem as described above with the glGetString of version. After patching a hardcoded result value in GL.GetString all the (non-hidden) examples ran mostly ok.

The GLSL examples check for !GL.SupportsExtension("VERSION_2_0") which is not defined. I changed this to !GL.SupportsExtension("GL_ARB_shading_language_100") as it seems more appropiate.

And unless running at startup before any other example Examples.Tests.InputLogger fails with:

Launching example: Examples.Tests.InputLogger
Native window driver: OpenTK.Platform.Windows.WinGLNative
Creating native window.
Initalizing WMInput driver.
Input window attached to parent Windows.WindowInfo: Handle 68358, Parent (null)
Window created: Windows.WindowInfo: Handle 68358, Parent (null)
Window creation succesful.
Creating GraphicsContext.
GraphicsMode: Index: 2, Color: 32 (8888), Depth: 24, Stencil: False, Samples: 0, Accum: 0 (0000), Buffers: 2, Stereo: False
IWindowInfo: Windows.WindowInfo: Handle 68358, Parent (null)
OpenGL will be bound to handle: 68358
Setting pixel format... 2
Creating render context (GL3)... System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at OpenTK.Platform.Windows.Wgl.Delegates.CreateContextAttribsARB.Invoke(IntPtr hDC, IntPtr hShareContext, Int32* attribList)
at OpenTK.Platform.Windows.Wgl.Arb.CreateContextAttribs(IntPtr hDC, IntPtr hShareContext, Int32[] attribList) in N:\gl3\Source\OpenTK\Platform\Windows\Bindings\Wgl.cs:line 551
at OpenTK.Platform.Windows.WinGLContext..ctor(GraphicsMode format, IWindowInfo window, IGraphicsContext sharedContext) in N:\gl3\Source\OpenTK\Platform\Windows\WinGLContext.cs:line 93
at OpenTK.Graphics.GraphicsContext..ctor(GraphicsMode mode, IWindowInfo window) in N:\gl3\Source\OpenTK\Graphics\GraphicsContext.cs:line 76
at OpenTK.Platform.Windows.WinGLNative.CreateWindow(Int32 width, Int32 height, GraphicsMode mode, IGraphicsContext& context) in N:\gl3\Source\OpenTK\Platform\Windows\WinGLNative.cs:line 369
at OpenTK.GameWindow..ctor(Int32 width, Int32 height, GraphicsMode mode, String title, GameWindowFlags options, DisplayDevice device) in N:\gl3\Source\OpenTK\GameWindow.cs:line 168
Destroying window: Windows.WindowInfo: Handle 68358, Parent (null)
Input window detached from parent 68358.

And works ok with trunk.

I also played around with the new way to query extentions with glGetStringi, the new way to query opengl version and a version 1.30 shader, which worked fine, see attachment.

AttachmentSize
BasicGL3.cs4.87 KB
the Fiddler's picture

#34

Thanks for testing! The first error (VERSION_2_0 not defined) should be easy to fix, the second appears (access violation) is probably a bug in the new context contsruction logic, possibly related to the temporary context used to obtain WGL extensions.

I'll work on these as time permits.

pokemoen's picture

#35

Update on the issues I described above for catalyst 9.2

* glGetString works: "3.0.8494 Release"
so because version.StartsWith("3.0"), GL.SupportsExtension("VERSION_2_0") returns true

* the access violation still occurs (a workaround here is to comment out wgl_loaded = true; when always creating the temp context it works for some reason)

Things I noticed in this driver version:

* Shader version still reported as 1.20, though 1.30 works fine (and is required for opengl 3.0 of course) (edit: a forward compatible context reports 1.30)

* And just as in 9.1, GL_EXT_geometry_shader4 is not defined, but entrypoints are available. Changes in 9.2 here are that geometry shaders do compile succesfully, but GL.LinkProgram throws an AccessViolationException, whereas in 9.1 the compiling failed. I assume this access violation is not due to OpenTK because the extension is not reported as supported.
I'm hoping geometry shader support will be completed soon for ati cards :)

update: I just tried a geometry shader in a GL2 context and a forward compatible GL3 context, the results are the same. Interesting detail I noticed is that the GL3 functions I used work in the GL2 context. (getting of Version30.NumExtensions, Version30.MinorVersion, Version30.MajorVersion and glGetStringi) I expected a GL2 context not to be forward compatible.
Although most of this is not OpenTK related per se, I'm just sharing my experiences with OpenTK gl3 branch.

martinsm's picture

#36

What is wrong if GL.SupportsExtension("VERSION_2_0") returns true when version starts with 3.0 ?
Isn't the OpenGL specification backward compatible?

pokemoen's picture

#37

Sorry if I was a bit unclear. GL.SupportsExtension("VERSION_2_0") returns true is good. In a previous post I wrote it returned false, but that was because I patched up GL.GetString to workaround a bug in catalyst 9.1. so the not reporting of VERSION_2_0 was not a bug; i introduced it myself. The reason for this is that VERSION_2_0 is set by OpenTK in GLHelper.cs if the version string start with 3.0, my patched up GL.GetString for version returned garbage :)

edit: And btw OpenGL does not have to be backward compatible, one can choose to create a forward comatible context by passing ArbCreateContext.ForwardCompatibleBit in the CreateContextAttribs at the contructor of ContextHandle, then alot of the earlier tokens and functions are obsolete. The gl3 branch does not create this kind of context, but a backward compatible one.

Inertia's picture

#38

After a clean reinstall, Catalyst 9.1 works fine on Radeon 3870, Vista x64, Net 3.5. The logs are from r1511 Examples, going to test with 9.2 next but without doubt that will work too.

Edit: Attached Catalyst 9.2 log. Works flawless kudos Ati!

AttachmentSize
Julia 9.2.txt6.78 KB
Font 9.1.txt6.8 KB
Julia 9.1.txt7.04 KB
the Fiddler's picture

#39

To all linux users out there with GL3 capable hardware (nvidia 8x00+ and ati 2x00+): can you please compile and run the attached file? It simply attempts to create a GL3 context and show a small window with colors.

Despite my best efforts, I haven't managed to make it run on an ati 4850 with the 9.2 drivers. Does it work for you? What is your hardware & drivers?

To use, simply open a terminal and type:

wget http://www.opentk.com/files/issues/gl3.cpp
g++ gl3.cpp -o gl3 -lX11 -lGL
./gl3

Edit: To anyone coming across this code, it works as long as you create a temporary context before calling glXGetProcAddress.

AttachmentSize
gl3.cpp3.77 KB
Mincus's picture

#40

Ok, running Xubuntu 8.10 64-bit (Kernel: 2.6.27-11-generic x86_64)
Using the 177.82 drivers in the repository I get the following:

GLX_EXT_visual_info GLX_EXT_visual_rating GLX_SGIX_fbconfig GLX_SGIX_pbuffer GLX_SGI_video_sync GLX_SGI_swap_control GLX_EXT_texture_from_pixmap GLX_ARB_multisample GLX_NV_float_buffer GLX_ARB_fbconfig_float GLX_EXT_framebuffer_sRGB GLX_ARB_get_proc_address
glXCreateContextAttribsARB entry point not found

Reading information from the nvidia website (http://developer.nvidia.com/object/opengl_3_driver.html) this driver doesn't support GL3, so that's expected.
I'll try again with the 180.11 ones in the repository.

Edit: Forgot to add that I'm using a Geforce 8600M GT.