Hello Constantin,

Constantin Müller wrote:
> I read the mails to the topic, because I have a similar problem.
> The problem is, that I have texture on the graphics card that I don't 
> want to copy back to the working memory.
> Now I want to put this texture onto an Object in the scene.
> 
> I work with OpenSG 2.0 and I have to say I have not much knowledge about 
> the FBOViewport, or how the stuff with the TextureChunk should work.

hm, the SimpleTextureMaterial is really only for simple cases and yours 
does not quite qualify as simple any more ;)
OpenSG splits the OpenGL state into parts (called StateChunks). A 
Material then often just becomes a bunch of chunks (e.g. a MaterialChunk 
  for the OpenGL material description, a TextureObjChunk to hold the 
texture and a TextureEnvChunk to describe how the texture applies to the 
geometry), so most materials you encounter are actually of type 
ChunkMaterial.
For the case above where you have a texture on the GPU already and just 
want to use it from OpenSG, create a ChunkMaterial and add a 
TextureObjRefChunk (with the GLid field set to the id of the texture), 
you may also want to add a MaterialChunk to set material properties for 
lighting and a TextureEnvChunk.

> I'm trying to use the getGLID() functions one of you mentioned, but I 
> got some problems with it.
> My approach is to create the OSG::Geometry with any Texture with 
> OSG::Material and OSG::SimpleTexturedMaterial.
> Then I want to get the GLID() of the Texture and change this on the GPU 
> with OpenGL commands.
> But how can I get access to the GLID() from the SimpleTexturedMaterial?

ok, here I'm afraid you lost me a little. Are you describing here how 
you create the texture you want to change on the GPU in the first place? 
   My explanation above was about what to do if you have the GL id of a 
texture (one that is created outside of OpenSG) and want to render some 
OpenSG geometry with it.
If you want to use a texture in multiple places you can add the same 
TextureObjChunk to multiple materials.

I'm not sure if this answers your question, if not could you please 
provide some more details on how you create the texture (using OpenSG or 
externally?), how you modify it on the GPU (do you use it as a render 
target of an FBO?) and what you want to apply it to (OpenSG geometry?).

        Cheers,
                Carsten

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to