<p>You cannot launch RenderDoc from within your programs by means of the API. You can however hook RenderDoc into your program from within your program.</p>
<p>RenderDoc needs to be attached before any graphics setup is done (e.g. before creating a Vulkan Instance or an OpenGL Context). This will enable you to capture frames in a more controlled manner - e.g. if you were to render an offscreen frame in OpenGL, RenderDoc has no way of knowing when your frame is done, so you could not capture it by default. The API let's you say when a frame starts and when it ends, and then you can use the capture functionality in RenderDoc and it will capture within your start and end points.</p>
<p>For this to work, you will have to &quot;fetch&quot; a running RenderDoc instance though.</p>
<p>You can see how to do that here:
<a href="https://renderdoc.org/docs/in_application_api.html" rel="nofollow noreferrer">https://renderdoc.org/docs/in_application_api.html</a></p>
<p>There is also a <a href="https://renderdoc.org/docs/python_api/index.html" rel="nofollow noreferrer">python API</a> for RenderDoc to script the application. I have never used it myself, so can't say much about it - but perhaps that's what you want for automatically starting it.</p>

CC BY-SA 4.0
2024-12-18T22:43:19.327Z
Sadly this is correct and not something that will be supported (I asked on Discord). So how does Unity do it? https://docs.unity3d.com/Manual/RenderDocIntegration.html
junglie85
CC BY-SA 4.0
2024-12-19T07:47:09.897Z
I can't answer that - but I know that Unreal Engine can do it, too. They do it via a plugin, but you should be able to see the code, as Unreal is open source.
Tare
CC BY-SA 4.0
2024-12-12T08:00:54.473Z
2024-12-12T08:00:54.473Z
Tare
<p>How can I open RenderDoc and attach an already running application to it for capture?</p>
<p>I see there is an in application API for use in applications that are already being debugged. But if I’ve understood correctly I need to have launched my application from RenderDoc to do this.</p>
<p>I’d instead like to launch RenderDoc from within my C++/win32 application and then use its API to create a capture.</p>

<rendering><debugging>
Launch RenderDoc from within an application
junglie85
# Launch RenderDoc from within an application

(Asked by: username_0 on 2024-12-11)

How can I open RenderDoc and attach an already running application to it for capture?

I see there is an in application API for use in applications that are already being debugged. But if I’ve understood correctly I need to have launched my application from RenderDoc to do this.

I’d instead like to launch RenderDoc from within my C++/win32 application and then use its API to create a capture.

**Tags:** rendering, debugging


---

## 1 answers

### Answer by username_1 on 2024-12-12. Score: 1 | Accepted answer

You cannot launch RenderDoc from within your programs by means of the API. You can however hook RenderDoc into your program from within your program.

RenderDoc needs to be attached before any graphics setup is done (e.g. before creating a Vulkan Instance or an OpenGL Context). This will enable you to capture frames in a more controlled manner - e.g. if you were to render an offscreen frame in OpenGL, RenderDoc has no way of knowing when your frame is done, so you could not capture it by default. The API let's you say when a frame starts and when it ends, and then you can use the capture functionality in RenderDoc and it will capture within your start and end points.

For this to work, you will have to "fetch" a running RenderDoc instance though.

You can see how to do that here:
<https://renderdoc.org/docs/in_application_api.html>

There is also a [python API](https://renderdoc.org/docs/python_api/index.html) for RenderDoc to script the application. I have never used it myself, so can't say much about it - but perhaps that's what you want for automatically starting it.

> **Comments:**
> **username_0**: Sadly this is correct and not something that will be supported (I asked on Discord). So how does Unity do it? https://docs.unity3d.com/Manual/RenderDocIntegration.html  
> **username_1**: I can't answer that - but I know that Unreal Engine can do it, too. They do it via a plugin, but you should be able to see the code, as Unreal is open source.  

---

