I don't have a tutorial, but I can explain how you might do this.  Assuming
your BLACK textures and WHITE textures are 64x64 pixels, and that you need
64 squares for the chessboard (8x8), you'd need to create a BufferedImage of
512x512.  Or:

    BufferedImage destImage = new BufferedImage(512, 512,
BufferedImage.TYPE_INT_RGB);

You then would need to then copy the data from your textures into the
BufferedImage.  You can create a BufferedImage out of the TextureLoader with
this line:

    BufferedImage srcImage = texureloader.getImage().getImage();

Actually copying the data from each srcImage can be done a variety of ways.
You might look into getting a WriteableRaster from destImage and using
setRect() to copy in each of your squares to the appropriate offset.  If
that fails, you can always loop over one BufferedImage and use getRGB(x, y)
and setRGB(x, y) on the other image, setting each pixel.  This will probably
be much slower than my first suggestion, but I haven't used setRect()
before.

Finally, you can construct the final texture from the new BufferedImage with
these two lines:

    Texture texture = new Texture2D(Texture2D.BASE_LEVEL, Texture2D.RGB,
width, height);
    texture.setImage(0, new ImageComponent2D(ImageComponent2D.FORMAT_RGB,
destImage));




----- Original Message -----
From: "Jo�o Paulo Menegatti" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, September 12, 2001 2:23 PM
Subject: Re: [JAVA3D] chess board


> Thank you for the idea Kevin, but will it be that you or does anybody have
> some reference or tutorial of use of BufferedImage and as I join several
> BufferedImages in a texture?
>
> []'s
>
> J.P.
>
> ----- Original Message -----
> From: "Kevin J. Duling" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, September 12, 2001 2:18 PM
> Subject: Re: [JAVA3D] chess board
>
>
> > You could create a new BufferedImage and create a new texture from one
> BLACK
> > and one WHITE image, tiling them.  Then you can build your Texture from
> the
> > BufferedImage.
> >
> >
> > ----- Original Message -----
> > From: "Jo�o Paulo Menegatti" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Wednesday, September 12, 2001 11:01 AM
> > Subject: Re: [JAVA3D] chess board
> >
> >
> > > Thanks Mark, but the problem is that I cannot create an image of the
> type:
> > >
> > > WHITE BLACK
> > > BLACK WHITE
> > >
> > > because the images are already ready and they will be variable the
> > > combinations.
> > >
> > > J.P.
> > >
> > > ----- Original Message -----
> > > From: "Mark Ferneau" <[EMAIL PROTECTED]>
> > > To: <[EMAIL PROTECTED]>
> > > Sent: Wednesday, September 12, 2001 11:20 AM
> > > Subject: Re: [JAVA3D] chess board
> > >
> > >
> > > > First generate a texture with four squares like this:
> > > >
> > > > BLACK  WHITE
> > > > WHITE  BLACK
> > > >
> > > > Then create a quad and assign the texture coordinates as 0, 0 in the
> > lower
> > > > left corner and 4, 4 in the upper right corner.  This should have
the
> > > > effect of repeating (tiling) the texture four times in both the
> vertical
> > > > and the horizontal direction.  Of course the upper left texture
> > > coordinates
> > > > should be 0, 4 and the lower right should be 4, 0.
> > > >
> > > > I think that should do it.  You might want to put a small border
> between
> > > > the colors.  This will help with any mipmapping texture wrapping
that
> > > would
> > > > occur on the edges of the polygon.
> > > >
> > > > --Mark
> > > >
> > > > At 09:49 AM 9/12/2001, you wrote:
> > > > >How can I generate a texture for an object of the type chess board,
> > using
> > > > >two images to compose the texture? (Image white and image black)
> > > > >
> > > > >[]'s
> > > > >
> > > > >J.P.
> > > >
> > > >
> > > > Mark Ferneau                    240-462-6262 (cell)
> > > > Director of Adv. Technology             801-437-4608 (efax)
> > > > Xtivia Technologies, Inc.               301-279-5703 (home office)
> > > > [EMAIL PROTECTED]                      http://www.xtivia.com/
> > > > [EMAIL PROTECTED] (wireless email)
> > > >
> > > >
> > >
> >
>
===========================================================================
> > > > To unsubscribe, send email to [EMAIL PROTECTED] and include in
the
> > > body
> > > > of the message "signoff JAVA3D-INTEREST".  For general help, send
> email
> > to
> > > > [EMAIL PROTECTED] and include in the body of the message "help".
> > > >
> > >
> > >
> >
>
===========================================================================
> > > To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> > body
> > > of the message "signoff JAVA3D-INTEREST".  For general help, send
email
> to
> > > [EMAIL PROTECTED] and include in the body of the message "help".
> > >
> >
> >
>
===========================================================================
> > To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> body
> > of the message "signoff JAVA3D-INTEREST".  For general help, send email
to
> > [EMAIL PROTECTED] and include in the body of the message "help".
> >
>
>
===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff JAVA3D-INTEREST".  For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
>

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to