simple texturing help

Hi guys… new around here!
:-/

very nice forum by the way!!
;D

My doubt is very simple…

How can I texture a single quad ?

the quad will be stored at QuadArray… i guess…

and maybe this texture can be a image in grayscale, to simule transparency…

Any kind of help is really appreciate.

thank you

ahhhh!! i am using java3d… of course…

ok… let me change my question…
:-/

How can I use the following image like a opacity map ??

http://www.meubrfree.com.br/~guivieira/star.png

Something along the lines of this:


QuadArray l_quad = new QuadArray(8, QuadArray.COORDINATES | GeometryArray.TEXTURE_COORDINATE_2 | QuadArray.COLOR_4);

//Set vertex world position
            l_quad.setCoordinate(0, new Point3f(0.0f, 0.0f, -3.0f));
            l_quad.setCoordinate(1, new Point3f(2.0f, 0.0f, -3.0f));
            l_quad.setCoordinate(2, new Point3f(2.0f, 3.0f, -3.0f));
            l_quad.setCoordinate(3, new Point3f(0.0f, 3.0f, -3.0f));
      
//Set vertex texture coordinates
            l_quad.setTextureCoordinate(0, 0, new TexCoord2f(0, 0));
            l_quad.setTextureCoordinate(0, 1, new TexCoord2f(1, 0));
            l_quad.setTextureCoordinate(0, 2, new TexCoord2f(1, 1));
            l_quad.setTextureCoordinate(0, 3, new TexCoord2f(0, 1));

//Set vertex color
l_quad.setColor(0, new Color4f(1, 1, 1, 1));
            l_quad.setColor(1, new Color4f(1, 0, 0, 1));
            l_quad.setColor(2, new Color4f(1, 1, 1, 1));
            l_quad.setColor(3, new Color4f(1, 1, 1, 1));
            
//Set up appearance with texture
            Appearance l_quadappearance = new Appearance();
            
            Texture l_quadtex = new TextureLoader("texture.jpg", this).getTexture();
            l_quadappearance.setTexture(l_quadtex);
            TextureAttributes l_texatt = new TextureAttributes();
            l_texatt.setTextureMode(TextureAttributes.MODULATE);
            l_quadappearance.setTextureAttributes(l_texatt);

//Add quad to new (or existing) branchgroup
BranchGroup l_group = new BranchGroup();
l_group.addChild(new Shape3D(l_quad, l_quadappearance));

This code should work, if it doesn’t let me know. I copy/pasted it from a prog I had here, so I might have missed something in the rush.

Hope this helps!

-Trond