Using renderdoc to debug low level graphics (advanced)

For debugging it may be useful to see all the OPENGL commands being sent to the GPU, the textures, mesh data, shaders, etc.

RenderDoc makes that possible.

This is how I got it running in Ubuntu:

  1. Download RenderDoc. In my case I downloaded the source and compiled it to have the latest version. This installed the file /usr/lib/ In ArchLinux I would use the system package instead of compiling.
  2. In Idea, go to Run > Edit Configurations... and under Environment Variables enter LD_PRELOAD=/usr/lib/ (or whatever is the path to the library in your case). (thanks @edwin)
  3. Launch the RenderDoc program (in my case called qrenderdoc)
  4. Start your OPENRNDR program. There should be a new text overlay on the top part of the window. Initially it says Inactive Window, then it changes to this:
  5. In RenderDoc, go to File > Attach to Running Instance, choose the java program listed and then click Connect to App. 2020-06-11-111153_563x414_scrot
  6. Now you can press F12 while your OPENRNDR program is focused and all the frame details will be transferred to RenderDoc, where you can explore GL calls, textures, mesh data, shaders in use, etc.

Here a screenshot of the program:

And exploring the mesh in RenderDoc:

Does the approach differ in Mac / Windows?

1 Like