0

This is my first time writing, so I apologize in advance for possible errors, repetitions or incorrect formatting....

First of all, using JOGL I created a texture and loaded it inside an OpenGL context.

So, I passed the context id and the texture id to OSG.

osg::ref_ptr<osg::Texture2D> texture = new osg::Texture2D();

osg::ref_ptr<osg::Texture::TextureObject> textureObject = new osg::Texture::TextureObject(texture.get(), (GLuint)handle, GL_TEXTURE_2D);

textureObject->setAllocated(true);

texture->setTextureObject(ID, textureObject.get());

So, first of all I thought the right thing was: take the handle of the OpenGL context and from that, get the texture knowing its ID.

The problem is that, if I print the size of the texture, this is zero. Knowing the size of the texture (Java side), which means that the procedure is not correct.

Can you tell me what is the correct procedure to take the texture knowing the OpenGL context id?

Rabbid76
  • 202,892
  • 27
  • 131
  • 174
  • You should probably use a shared context to do that, I did it more than ten years ago between JOGL and OpenInventor, it should work. Rather ask your JOGL specific questions on our official forum https://forum.jogamp.org. – gouessej Oct 08 '22 at 13:10
  • Thanks @gouessej, but I can't find the specific thread in the forum you reported to me. I am investigating the sharedContext, but I don't know if it is the correct way. – Marc Romano Oct 11 '22 at 06:28
  • I suggested you to ask your question on our official forum, not to look for an existing reply. Most JogAmp contributors never come on StackOverflow. You can see how to use shared contexts by looking at JOGL unit tests and in JogAmp's Ardor3D Continuation (based on JOGL). – gouessej Oct 13 '22 at 18:44

0 Answers0