PDA

View Full Version : how to get support for GL_ARB_debug_output



vamsee
08-20-2012, 08:02 AM
Hi all,

I was trying to check out the "GL_ARB_debug_output" extension.
When i ran the 'glewInfo.exe' it gave me the below result for this extension

GL_ARB_debug_output: OK [MISSING]
--------------------
glDebugMessageCallbackARB: OK
glDebugMessageControlARB: OK
glDebugMessageInsertARB: OK
glGetDebugMessageLogARB: OK

Why des it say 'OK' and also 'Missing' ??

Also when i checked in code with

glewIsSupported("GL_ARB_debug_output")
it returned false.

Im using Nvidia GTX 460M , with driver version 304.48 (open gl version 4.2)
does this mean that i cannot enable this extension at all??

or are there any ways of getting this extension to work?

Aleksandar
08-20-2012, 08:10 AM
I'm not sure how GLEW implements that, but what you have to do is to:
- create a debugging GL context, and
- grab pointers for needed functions.
I can bet 304.xx drivers support debug_output.

vamsee
08-20-2012, 08:25 AM
hmmmn ... for creating debug context im passing these attribs

int attribs[] =
{
WGL_CONTEXT_MAJOR_VERSION_ARB, 4,
WGL_CONTEXT_MINOR_VERSION_ARB, 2,
WGL_CONTEXT_FLAGS_ARB,
WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB | WGL_CONTEXT_DEBUG_BIT_ARB ,
WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_CORE_PROFILE_BIT_ARB,
0
};

And while creating the context im using this :

PFNWGLCREATECONTEXTATTRIBSARBPROC my_wglCreateContextAttribsARB = NULL;
my_wglCreateContextAttribsARB = (PFNWGLCREATECONTEXTATTRIBSARBPROC) wglGetProcAddress("wglCreateContextAttribsARB");

if(my_wglCreateContextAttribsARB!=NULL)
{
wglMakeCurrent(NULL,NULL);
wglDeleteContext(tempContext);

glrc = my_wglCreateContextAttribsARB(hDC,0, attribs);

wglMakeCurrent(hDC, glrc);
}

So, is this correct for creating a debug context? and also how do i confirm that i have/can create a debug context??

is there any command that i can issue to check if debug context is indeed created ??

And if the above is correct, then can you point me at how i can get the address of the debug functions?

Aleksandar
08-20-2012, 09:09 AM
Looks OK.

The only purpose of debugging context is to enable debugging. So if you can call debug_output functions you certainly have a debug context.
Is glrc context is valid? Try to debug and take a look at the value of that handle.

vamsee
08-20-2012, 09:12 AM
yeah the handle is valid, i can draw primitives and all ....

but, i cant make any debug functions to work!

Alfonse Reinheart
08-20-2012, 09:19 AM
how do i confirm that i have/can create a debug context?

If you have GL 4.3, you can query `GL_CONTEXT_FLAGS` and test the result against `GL_CONTEXT_FLAG_DEBUG_BIT`. But if you don't, you can't.

However, if you have reasonably up-to-date drivers, creating a debug context will cause NVIDIA's drivers to spam error messages to standard out. So if you don't get that spam, you probably didn't do it right.

vamsee
08-20-2012, 09:35 AM
So for earlier versions of openGL there is no way of confirming that debug context is enabled??
thats sad!

im on the latest drivers for my card(not the beta drivers though). I still dont see any error messages.
but im working on my laptop with a mobile graphic card, so may be that could be a problem.

Can any one share with me any code snippet that works on your machine for setting a debug context?

Alfonse Reinheart
08-20-2012, 01:07 PM
So for earlier versions of openGL there is no way of confirming that debug context is enabled??
thats sad!

Why? Until KHR_debug (the core extension that introduced debug output), there was no behavior in OpenGL that changed based on it. An implementation does not have to offer ARB_debug_output if you use a debug context. An implementation does not have to remove ARB_debug_output if you don't ask for a debug context.

So being able to check for a debug context never mattered before KHR_debug. Which is why it is KHR_debug that adds the `GL_CONTEXT_FLAG_DEBUG_BIT`.

vamsee
08-21-2012, 10:38 AM
sorry but i dont understand where did KHR_debug came in between ARB_debug, arent they like different implementations or something??
(i also checked for the KHR_debug, that also is shown as missing in glew output)

may be im going off topic here, so coming back to what i was asking for

what is the solution to this problem ? (how do i make sure my current drivers have arb_debug_output supported?)

Alfonse Reinheart
08-21-2012, 11:00 AM
how do i make sure my current drivers have arb_debug_output supported?

You cannot.

You can set the debug flag in your context creation logic. But if the implementation doesn't want to expose ARB_debug_output, that is its right. Just like you can't force support for ARB_tessellation_shader or any other extension.

That being said, the easiest way to test this is really simple: use someone else's context creation code. Download FreeGLUT and make a simple application with it, using the GLUT_DEBUG flag. If that gets you ARB_debug_output, then clearly the issue is with your context creation code. If it doesn't, then your implementation doesn't support ARB_debug_output.

vamsee
08-21-2012, 11:25 AM
Thanks for your inputs, luckily i dinn have to go through the freeGlut route, i doubt it would have given any different result. Because, i finally solved it!!!

As it turns out my code was absolutely fine, just that the drivers did not have the implementation for arb_debug_output.(my latest drivers dont have the extension!, But the desktop version do have them!)
i've used the latest desktop drivers (used the modded inf file to get it installed on my laptop)

then tested my app again, and VOILA it works like a charm! ............. finally!

Thanks all for your inputs.