0

I'm using CodeXL to debug my OpenGL app. I'm pausing the app in CodeXL and looking through the texture list. That works fine but the textures in the list are named only like "Texture <some_number_here>". I want to programatically assign names to the textures so they're easier to browse. Is this possible?

I've googled and found glObjectLabel but this requires OpenGL 4.3 and I only have access to 3.0 on this PC. I could try to install better drivers to get access to higher versions but before I mess with that, I'd like a confirmation that glObjectLabel will help for my case (for CodeXL, and it would be nice if it's supported by other GPU debuggers too).

Stefan Monov
  • 11,332
  • 10
  • 63
  • 120
  • In relation to `glObjectLabel()`, couldn't you just use something along `map`? – vallentin Apr 14 '17 at 18:56
  • @Vallentin: My debugger (CodeXL) wouldn't know about a map that I happened to create in my code. – Stefan Monov Apr 14 '17 at 18:59
  • If you in place of `glGetObjectLabel()` instead did `textureLabels[textureName]`. Wouldn't it then equally *resolve* the label and show that? – vallentin Apr 14 '17 at 19:02
  • @Vallentin: Are you suggesting that I edit CodeXL's own code? I don't want to do that, since that would probably take a lot of work. – Stefan Monov Apr 14 '17 at 19:06
  • Ohh, I realize how that CodeXL isn't just a regular debugger (or how to say it). My point-of-view was that when stepping though the code `glGetObjectLabel()` would cause the debugger to tell the name, which equally could be achieved with `textureLabels[textureName]`. – vallentin Apr 14 '17 at 19:09
  • @Vallentin: Well, the part of CodeXL that I'm using is really just the the debugger for now. But **part of the debugger** is a sidebar with a list of textures, letting you actually view the pixel data of the texture (when the app is paused). This sidebar is not connected to the code that created the textures, so to speak. – Stefan Monov Apr 14 '17 at 19:13
  • 1
    It's very unlikely that you have access to exactly OpenGL 3.0; and, anyhow, are you sure you don't have access to the `KHR_debug` extension? – peppe Apr 14 '17 at 22:10
  • Wrap your texture object in a structure like class.Add to it a 'name' property.What's a problem doing it?You don't need any GL4.x fancy features to hook some metadata on your GL objects. – Michael IV Apr 15 '17 at 14:32
  • @MichaelIvanov: You have the same misunderstanding as Vallentin above. – Stefan Monov Apr 17 '17 at 14:19
  • @peppe: `glxinfo` says I do have KHR_debug, but `QOpenGLContext::currentContext()->hasExtension("KHR_debug")` returns false. When I include a KHR_debug call (glObjectLabel) in my app and run it in CodeXL, it breaks on that call, giving me GL_INVALID_VALUE for some reason. And so, of course, the sidebar doesn't show the names I assigned. – Stefan Monov Apr 17 '17 at 15:56
  • @peppe: `glxinfo` prints `OpenGL version string: 3.0 [...]`. But now that I reran `glxinfo`, I noticed that it also prints `OpenGL core profile version string: 4.3 (Core Profile) [...]`. But for some reason, [QOpenGLFunctions_4_3_Core](http://doc.qt.io/qt-5/qopenglfunctions-4-3-core.html) doesn't include glObjectLabel (when it should). – Stefan Monov Apr 17 '17 at 16:00
  • Please submit a bug report against Qt. Those QOpenGLFunctions_X_Y classes are autogenerated from some XML files published by Khronos describing the OpenGL APIs, chances are the source XML files were bugged. – peppe Apr 18 '17 at 09:57
  • Also, it should be `hasExtension("GL_KHR_debug")`. – peppe Apr 18 '17 at 09:57

0 Answers0