Daniel Selman wrote:
> Vidya,
>
> I just use something like:
>
> BufferedImage perlinTextureImage = new BufferedImage( MAX_TEXTURE_SIZE,
> MAX_TEXTURE_SIZE, BufferedImage.TYPE_3BYTE_BGR );
>
> I can then use getRGB(), setRGB() to read/write the color data. What are the
> advantages of setting up the ColorModel explicitly?

Control over how big the image is in memory. For example, most sky/cloud
textures are really only for alpha blending. At most, you only want a
256 color greyscale image - so you set the colour model to be that. This
way you only use 1 byte per pixel rather than 4, which is really
important if you are doing a lot of texture manipulation.

*HOWEVER*

Note that there is a serious bug in java3D that AFAIK has always existed
(at least all the 1.2.x and 1.3b1). You cannot use any other colour
model other than 4 bytes per pixel for java3d textures. ImageComponent2D
has a bug that crashes the constructor because of some wrong assumptions
it makes. I have a bug report in for that and a promise of a fix for
1.3beta2. Unfortunately there doesn't seem to be a plan for fixing this
for the 1.2 series, so if you do this, you will be writing
J3D1.3-specific code, even if you don't use the new APIs.

--
Justin Couch                         http://www.vlc.com.au/~justin/
Java Architect & Bit Twiddler              http://www.yumetech.com/
Author, Java 3D FAQ Maintainer                  http://www.j3d.org/
-------------------------------------------------------------------
"Humanism is dead. Animals think, feel; so do machines now.
Neither man nor woman is the measure of all things. Every organism
processes data according to its domain, its environment; you, with
all your brains, would be useless in a mouse's universe..."
                                               - Greg Bear, Slant
-------------------------------------------------------------------

===========================================================================
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