# Is it possible to integrate OpenGL code as a plugin for Unreal?

**URL:** <https://forums.unrealengine.com/t/is-it-possible-to-integrate-opengl-code-as-a-plugin-for-unreal/364055>\
**Category:** C++\
**Tags:** integration, opengl, unreal-engine, UE4, CPP, question\
**Created:** [July 14, 2016, 7:12pm UTC](https://forums.unrealengine.com/t/is-it-possible-to-integrate-opengl-code-as-a-plugin-for-unreal/364055 "2016-07-14T19:12:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_7e9670e3](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_7e9670e3](https://forums.unrealengine.com/u/anonymous_user_7e9670e3)\
**Post date:** [July 14, 2016, 7:12pm UTC](https://forums.unrealengine.com/t/is-it-possible-to-integrate-opengl-code-as-a-plugin-for-unreal/364055/1 "2016-07-14T19:12:09Z")

</div>

Suppose I have a graphics application written in C++/OpenGL/GLFW/GLEW/GLSL/GLM, is it possible to load the OpenGL application as an external script/plugin? or do I have to throw away the OpenGL code and recreate everything from scratch using Unreal?

The motivation is I want to hand over the work to another developer that is familiar with Unreal (but not OpenGL) so he can add UIs, create and animate CG objects etc on top of the graphics application written by OpenGL.

---

<div class="post-metadata">

**Author:** ![Shadowriver](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Shadowriver](https://forums.unrealengine.com/u/Shadowriver)\
**Post date:** [July 14, 2016, 9:05pm UTC](https://forums.unrealengine.com/t/is-it-possible-to-integrate-opengl-code-as-a-plugin-for-unreal/364055/2 "2016-07-14T21:05:32Z")

</div>

If it was sperete view port or somehow render on top of UE4 window then i think that might be possible, C++ in UE4 is still normal C++ so you can technically do anything there but not everything will cooperate with engine APIs, also specific use of OpenGL will reduce portabbility capabilities, maybe not on PC and Mac but on consoles yes.

UE4 use rendering interface called RHI which you send rendering commands to it and RHI will translate it to library that it’s curretly using, DX, OpenGL, any library that consoles platfrom uses. Slate alone give you rendering options to, you can paint custom (sadly only 2D) vertieces data:

> **[FSlateDrawElement::MakeCustomVerts](https://docs.unrealengine.com/5.1/en-US/API/Runtime/SlateCore/Rendering/FSlateDrawElement/MakeCustomVerts/)**

Or even inject RHI commands in to rendering system

> **[FSlateDrawElement::MakeCustom](https://docs.unrealengine.com/5.1/en-US/API/Runtime/SlateCore/Rendering/FSlateDrawElement/MakeCustom/)**
>
> Creates a custom element which can be used to manually draw into the Slate render target with graphics API calls rather than Slate elements

I think those 2 above can help you out, i personally testing them out right now 🙂

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_7e9670e3](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_7e9670e3](https://forums.unrealengine.com/u/anonymous_user_7e9670e3)\
**Post date:** [July 14, 2016, 10:18pm UTC](https://forums.unrealengine.com/t/is-it-possible-to-integrate-opengl-code-as-a-plugin-for-unreal/364055/3 "2016-07-14T22:18:06Z")

</div>

Thanks a lot for the answer. I would like to somehow place the Unreal rendering on top of the OpenGL rendering. To narrow down the problem, is it possible to draw two triangles in the same viewport and one with a glDrawElements call and one with a UE4 RHI call?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_7e9670e3](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_7e9670e3](https://forums.unrealengine.com/u/anonymous_user_7e9670e3)\
**Post date:** [July 14, 2016, 10:18pm UTC](https://forums.unrealengine.com/t/is-it-possible-to-integrate-opengl-code-as-a-plugin-for-unreal/364055/4 "2016-07-14T22:18:48Z")

</div>

Another question is is it possible to draw two triangles in the same viewport and one with a glDrawElements call and one with UE4 blueprint?

---

<div class="post-metadata">

**Author:** ![Shadowriver](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Shadowriver](https://forums.unrealengine.com/u/Shadowriver)\
**Post date:** [July 15, 2016, 2:03am UTC](https://forums.unrealengine.com/t/is-it-possible-to-integrate-opengl-code-as-a-plugin-for-unreal/364055/5 "2016-07-15T02:03:00Z")

</div>

you can’t use UE4 viewport, you would need to render on top of UE4 viewport… if thats even possible to begin with
