Hello,
I would like to draw OpenGL elements through JOGL inside an external OPenGL context / drawable created by a C program. But I think I did not understand very well how to use this. What I do is:
-
create a JVM and launch my main program by JNI through the C program (works OK)
-
create a window in my C program, initialize the OpenGL context and associated stuff, and when I’m ready:
-
call my Java program through JNI and perform the associated code:
GLDrawableFactory factory = GLDrawableFactory.getFactory(); if (factory.canCreateExternalGLDrawable()) { GLContext context = factory.createExternalGLContext(); context.makeCurrent(); GLDrawable drawable = factory.createExternalGLDrawable(); GLCapabilities caps = drawable.getChosenGLCapabilities(); DefaultGLCapabilitiesChooser chooser = new DefaultGLCapabilitiesChooser(); GLJPanel panel = new GLJPanel(caps, chooser, context); panel.createContext(context); }
I get an exception in my GLJPanel context creation because it seems that there is no Pbuffer available (NullPOinter Exception). Unfortunately, I can’t get the system.out/err messages in the JOGL library because I’m in a Windowed environement.
I’m sure I’m doing it all wrong, but I really don’t know how to get it right.
Does somebody have a clue on what is faulty in my code (it sure is).
Hervé