Open seperate openGL Context with OpenFx


#1

Hello,

i want to create a seperate openGL Context out of my openfx plugin.

after studying openfx-misc plugins i came to the conclusion that it is only possible to draw in the image view of natron.

is there any other way to initialize a seperate opengl context?

what i tried:

  • compile helloworld.exe and start via system ("helloworld.exe");
  • gluInit(argc,argv) in the createInstance() function of OFX

when starting a exe out of ofx the communication between OFX and helloworld.exe is hard to do
also the thread handling seems very complicated

to give you an ovierview of my goal :

  1. create 3d Visualisation of Colorspace via opengl
  2. User can manipulate gammut etc.
  3. apply manipulation on image via openFX

thank you very much
appreciate any help

manu


(Frédéric Devernay) #2

OpenGL rendering is something different from OpenGL drawing and interaction.

  • OpenGL rendering is done through the “OpenGL Render Suite”. This is what Shadertoy and TestOpenGL examples do
  • OpenGL Interaction (i.e. drawing and mouse interaction, as you would do with GLUT) is done through Overlay interacts interacts. See the CornerPin plugin source for how to use interacts, or ContactSheet for a much simpler interaction. When the user is done editing, he/she wants to get rid of the interact and see the render. This can easily be done using a boolean param with the label “Show Interact”. At the beginning of each Interact function (draw, penUp, penDown, penUp), if this param is false the function should do nothing and return false (indicating it did nothing).

(Frédéric Devernay) #3

See also http://openeffects.org/documentation/reference/ch03s04.html#idp11495440 if you intend to use OpenFX directly and not the Support library (used by all openfx-misc plugins)


(Frédéric Devernay) #4

Another completely different is to have your plugin launch a different process which will create its own GUI and communicate with the plugin via a socket for example. This has to be is a separate process, and this is what make things complicated. I think NeatVideo does this.


#5

i checked the testOpenGL plugin. For my purpose i will need to include glew.h.I successfully compile the TestOpenGL Plugin with glew.h included, but as soon as i start the plugin in natron, natron gets stucked.

Do you have any idea how to use the openGL function from glew.h in openfx?


(Frédéric Devernay) #6

openfx plugins should not depend too much on external libraries. glew should be fine. glad is fine too. Just make sure whether you want OpenGL rendering or an openGL interact (see my messages above and the openfx documentation)


#7

I went with the approach to launch an external application and share data between the application and OFX with boost::interprocess. Thanks for the advice Frédéric.

Now I need to find a way to trigger the host render call, whenever my external application has changed the data. Any ideas? I created a new topic for this question