On 5/17/05, Dirk Reiners <[EMAIL PROTECTED]> wrote:
>
> Hi Terry,
>
> On Mon, 2005-05-16 at 17:19 -0500, Terry Welsh wrote:
> > Okay, after a nice day of hacking and slashing, I have found that
> > OpenSG doesn't use glGenTextures to get texture IDs. However, other
> > code I am using does use glGenTextures, and I wind up with conflicting
> > IDs.
>
> Ack! Ok, I should have known that you generate your own textures, that
> would be a pretty clear hint.
>
> > This appears to be the cause of all my mysterious warning
> > messages. So is there a proper way to get texture IDs in OpenSG? And
> > why isn't glGenTextures used?
>
> The problem with using GenTextures is that it has to be called with an
> active OpenGL context. In a multi-threaded environment, it's pretty much
> a given that the thread creating the texture is not the one doing the
> rendering, so it can't call GenTextures. Given that OpenGL allows you to
> use your own IDs, I just manage my own IDs and that solved the problem.
> I didn't expect people to mix OpenSG with other OpenGL code (and not
> many people do it anyway), so I didn't expect that to be a problem.
You have probably given this way more thought than me, but I'll just
ask anyway. Why not have TextureChunks generate their IDs with
glGenTextures when they first try to render and store a map of
contexts to texture IDs? Then you would only be generating IDs in a
valid rendering context.
>
> To get IDs from OpenSG now you can do the following:
>
> void dummy(Window*, UInt32)
> {
> }
>
> UInt32 id = Window::registerGLObject
> (osgTypedFunctionVoidFunctor2Ptr<Window, UInt32>(dummy), 1);
>
> (replace 1 with the number of contiguous ids you want).
>
> Hope it helps
This could probably work for just me, but not when using other
libraries with OpenGL code. Currently I'm avoiding the problem with
this nice little hack that comes before all the OpenGL code:
GLuint ids[1000];
glGenTextures(1000, ids);
>
> Dirk
>
> --
> -- Dirk Reiners OpenSG Forum [EMAIL PROTECTED]
> -- The OpenSG Open Source Scenegraph: http://www.opensg.org
> -- Join the list at http://lists.sf.net/lists/listinfo/opensg-users
>
> -------------------------------------------------------
> This SF.Net email is sponsored by Oracle Space Sweepstakes
> Want to be the first software developer in space?
> Enter now for the Oracle Space Sweepstakes!
> http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
> _______________________________________________
> Opensg-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/opensg-users
>
-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_idt12&alloc_id344&opÿick
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users