Hi Enrico,
On Mon, 2004-03-22 at 02:47, Enrico Borrione wrote:
> hi all (and good Monday morning ^_^),
> i am trying to insert in my OpenSG app the support for cubemaps and
> vertex/fragment programs. I have 2 questions for ya:
>
> 1) Is there a way to load automatically the six faces, without
> repliacating six times the same instructions? I expand the idea:
>
> In OpenGL when u load in memory a cubemap u can use a single for cycle
> to make all the stuff running. In c++ way u may say:
>
> for (int side=0;side<6;side++)
> {
> *** load the image for the side ***
> glTexImage2D( GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB+side,0,GL_RGB8,64,
> 64, 0, GL_RGB, GL_FLOAT, pixel_data);
> }
>
> Is there a way to do the same thing in OpenSG? (no serious reason, just
> to cut a bit the code).
Not yet, but if you write it I'd be happy to include it. ;)
> 2) when i pass the texture data to the fragment program in OGL i just
> say:
>
>
> glActiveTexture(GL_TEXTURE#);
>
> where # is the number of the texture i wish to bind as a parameter to
> the fp. How can i do the same thing in OSG? I saw a couple of
> instructions sounding like
>
> activateTexture(Window *win, UInt16 texture) osg::TextureChunk
> [inline,static]
>
>
> activeTexture(Window *win, UInt16 texture) osg::TextureChunk
> [inline,static]
>
> but i don't really know if they are what i am needing. My objective is
> to be able to use an instruction like:
>
> TEX texcolor, texcoord[1], texture[1], CUBE;
>
> and be sure that my cubemap is actually binded to texture[1].
As Michael said, you can add TextureChunks to a ChunkMaterial or
SimpleMaterial, and the order defines which texture unit they're used
in.
If you use a current version (i.e. less than two weeks or so old), you
can also explicitly assign slots to the chunks you add, using the slot
parameter for addChunk(), e.g. simplemat->addChunk(texchunk,2); would
add a texture for texture unit 2.
Hope it helps
Dirk
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users