PDA

View Full Version : Adding Opengl Extensions (ARB_direct_state_access)



Rockindooodle
12-07-2015, 05:22 PM
Im trying to use Opengl 4.5 functions such as CreateBuffer() and Ive initialized GLEW but I do not understand how to Implement ARB_direct_state_access to make the 4.5 functions work.

if I say:

if(GLEW_ARB_direct_state_access)
{
glewInit()
}

The CreateBuffers Seem to work (I think) but now CreateShader() Yields another access error. I know Im doing something wrong. Ive been looking all over but cannot seem to find any tut on how to actually use ARB_direct_state_access to make functions work. Thank you!

Alfonse Reinheart
12-08-2015, 06:06 AM
You have that backwards. You always initialize GLEW; the condition on GLEW_ARB_direct_state_access is whether you use the DSA functions.

Rockindooodle
12-08-2015, 12:09 PM
Thank you for your reply, Writing it like this:

glewInit();
GLEW_ARB_direct_state_access;


Still gives me access error at CreateBuffers() however, while GenBuffers() works.

I dont think Im implementing GLEW_ARB_direct_state_access The right way at all.

If I could use opengl 4.5 I would; thanks!

GClements
12-08-2015, 12:21 PM
Writing it like this:
glewInit();
GLEW_ARB_direct_state_access;

Still gives me access error at CreateBuffers() however, while GenBuffers() works.



glewInit();
if (GLEW_ARB_direct_state_access) {
// DSA is supported
}
else
{
// DSA isn't supported
}

Rockindooodle
12-08-2015, 12:40 PM
glewInit();
if (GLEW_ARB_direct_state_access) {
// DSA is supported
}
else
{
// DSA isn't supported
}


wow thank you! I now know DSA is not supported, I have just one more question, would this be a driver issue? I have opengl 4.3 currently installed. how do I fix this. THANKS!

Dark Photon
12-08-2015, 01:01 PM
DSA isn't in defined in core OpenGL prior to OpenGL 4.5 (link (https://www.opengl.org/wiki/Direct_State_Access)). So if your drivers only support OpenGL 4.3, you'll be accessing it via the ARB_direct_state_access extension (if supported). It's possible your current drivers just don't support it.

You might use glGetString() (https://www.opengl.org/sdk/docs/man/html/glGetString.xhtml) to print out GL_VENDOR, GL_RENDERER, GL_VERSION, and GL_EXTENSIONS. That'll give you more information. If your drivers support ARB_direct_state_access (https://www.opengl.org/registry/specs/ARB/direct_state_access.txt), you'll see it in the GL_EXTENSIONS string.

GClements
12-08-2015, 04:16 PM
You might use glGetString() (https://www.opengl.org/sdk/docs/man/html/glGetString.xhtml) to print out GL_VENDOR, GL_RENDERER, GL_VERSION, and GL_EXTENSIONS.

Alternatively, use glGetStringi( GL_EXTENSIONS, i), with the range of i determined by glGetIntegerv(GL_NUM_EXTENSIONS). It's possible that a driver might not report all of the extensions via glGetString(GL_EXTENSIONS) in order to keep the length of the result down. Modern code should be using glGetStringi() (in the core profile, GL_EXTENSIONS isn't a valid argument to glGetString()).

Also, try setting glewExperimental; that causes GLEW to query function pointers regardless of whether the extension is listed in the result of glGetString(GL_EXTENSIONS). I don't know whether GLEW_ARB_direct_state_access is based upon the extension string or the function pointer, so check whether glCreateBuffers() is non-null.

Alfonse Reinheart
12-08-2015, 05:16 PM
Considering when 4.3 shipped and when ARB_direct_state_access shipped, it's highly unlikely to find an implementation that supports only 4.3 (and not 4.4) which also supports ARB_direct_state_access.