Hi,
This bug 4730414 - Text2D setString() throws Texture illegal size
Exception
is fixed in the next release.
A simple fix is to modify the utility source
com.sun.j3d.utils.geometry.Text2D.
public void setString(String text)
and chage
getAppearance().getTexture().setImage(0, imageComponent);
to
Texture tex = getAppearance().getTexture();
int width = tex.getWidth();
int height = tex.getHeight();
if ((imageComponent.getWidth() == width) &&
(imageComponent.getHeight() == height)) {
tex.setImage(0, imageComponent);
} else {
Texture2D newTex = setupTexture(imageComponent);
// copy old texture attributes to newTex if necessary.
getAppearance().setTexture(newTex);
}
And add
imageComponent.setCapability(ImageComponent.ALLOW_SIZE_READ);
in
private ImageComponent setupImage()
- Kelvin
------------
Java 3D Team
Sun Microsystems Inc.
ZACZEK, MARIUSZ P. (JSC-DM) (NASA) wrote:
>
> yes, I had some similar problems. Although sometimes (depending on the
> font used) even making the text bigger caused
> a problem when trying to write in something smaller...the only way to
> avoid it was to have the exact same size text.
>
> It's a wierd problem.
>
> Mario
>
> Mariusz Zaczek
> NASA - Johnson Space Center
> Automated Vehicles and Orbit Analysis / DM35
> Flight Design and Dynamics Division
> Mission Operations Directorate
> Bldg: 30A Room: 3048B
>
> Disclaimer: "The opinions, observations and comments expressed in my email
> are strictly my own and do not necessarily reflect
> those of NASA."
>
>
> -----Original Message-----
> From: Kevin J. Duling [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, October 10, 2002 2:31 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [JAVA3D] Possible Text2d Bug
>
> I also ran into this recently under Java 1.4.0_01 and Java3D 1.3. I
> discovered that if I change the text to a live Text2D object, I run
> the risk of hitting this. I have found that if I define the initial
> text to be larger than what I'm changing the text to, I'm able to
> avoid the exception.
>
>
> ----- Original Message -----
> From: Alessandro Borges <mailto:[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>
> Sent: Wednesday, October 09, 2002 5:24 AM
> Subject: Re: [JAVA3D] Possible Text2d Bug
>
> Roy,
> I was confused,
> but I discover this bug only happens under Java 1.4.
> If you use Java 1.3.1 there is no exceptions.
>
>
>
> Se below :
> Using Java 1.3 (sucessful) :
> java -showversion -Dj3d.debug=true Text2dTest2
> java version "1.3.1_02"
> Java(TM) 2 Runtime Environment, Standard Edition (build
> 1.3.1_02-b02)
> Java HotSpot(TM) Client VM (build 1.3.1_02-b02, mixed mode)
>
> Java 3D 1.3, Windows version is 5.0 Build: 2195, Windows NT
> [Display Driver] s3savg4.dll, S3 Inc. Savage4, Product 5
> Version 12.1, Build 8009, VendorId 251552360
> DeviceId 0x5333, SubSysId 0x8a22, Revision 0x69808
> [Desktop Mode] 1024x768 75 MHz, D3DFMT_X8R8G8B8
> [Device] Hardware Rasterizer
> [Device] Reference Rasterizer (AA)
>
> Use S3 Inc. Savage4, Hardware Rasterizer
>
> Create device :
> Window 200x200 D3DFMT_X8R8G8B8, handle=3104ac,
> D3DMULTISAMPLE_NONE, D3DSWAPEFFEC
> T_COPY, D3DFMT_D24S8
> Max Texture Unit Stage support : 2
> Max Simultaneous Texture unit support : 2
>
>/********************************************************************************/
>
> Now Using Java 1.4 (failed):
>
> java version "1.4.0_01-ea"
> Java(TM) 2 Runtime Environment, Standard Edition (build
> 1.4.0_01-ea-b02)
> Java HotSpot(TM) Client VM (build 1.4.0_01-ea-b02, mixed mode)
>
> Java 3D 1.3, Windows version is 5.0 Build: 2195, Windows NT
> [Display Driver] s3savg4.dll, S3 Inc. Savage4, Product 5
> Version 12.1, Build 8009, VendorId 386884200
> DeviceId 0x5333, SubSysId 0x8a22, Revision 0x69808
> [Desktop Mode] 1024x768 75 MHz, D3DFMT_X8R8G8B8
> [Device] Hardware Rasterizer
> [Device] Reference Rasterizer (AA)
>
> Use S3 Inc. Savage4, Hardware Rasterizer
>
> Create device :
> Window 200x200 D3DFMT_X8R8G8B8, handle=9049e,
> D3DMULTISAMPLE_NONE, D3DSWAPEFFECT
> _COPY, D3DFMT_D24S8
> Max Texture Unit Stage support : 2
> Max Simultaneous Texture unit support : 2
> java.lang.IllegalArgumentException: Texture:illegal image size
> at
> javax.media.j3d.TextureRetained.checkImageSize(TextureRetained.java:3
> 89)
> at
> javax.media.j3d.TextureRetained.setImage(TextureRetained.java:423)
> at javax.media.j3d.Texture.setImage(Texture.java:869)
> at
> com.sun.j3d.utils.geometry.Text2D.setString(Text2D.java:118)
> at Text2dTest2$1.mouseClicked(Text2dTest2.java:75)
> at java.awt.AWTEventMulticaster.mouseClicked(Unknown Source)
> at java.awt.Component.processMouseEvent(Unknown Source)
> at java.awt.Component.processEvent(Unknown Source)
> at java.awt.Component.dispatchEventImpl(Unknown Source)
> at java.awt.Component.dispatchEvent(Unknown Source)
> at java.awt.EventQueue.dispatchEvent(Unknown Source)
> at
> java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown
> Source)
>
> at
> java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
> at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
> at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
> at java.awt.EventDispatchThread.run(Unknown Source)
>
>
> Alessandro Borges
>
>
> ----- Original Message -----
> From: Roy Duffy <mailto:[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>
> Sent: Tuesday, October 08, 2002 7:59 PM
> Subject: Re: [JAVA3D] Possible Text2d Bug
>
> Hi Alessandro,
> Thanks for responding. I tried adding those lines and I
> still got the exception. Then I tried using your code and I
> still got the exception. What am I missing here?
> It also doesn't seem like the type of exception I'd get if I
> didn't have a capability set.
>
> Alessandro borges wrote:
>
>>
>>
>> Hi, Roy !
>>
>> There is no Text2D bug.
>> you just forget to add the following lines :
>> text.setCapability( Shape3D.ALLOW_GEOMETRY_READ);
>> text.setCapability( Shape3D.ALLOW_GEOMETRY_WRITE);
>>
>> See your code working in the zip file ;)
>>
>> Alessandro
>>
>>
>> ---
>> Outgoing mail is certified Virus Free.
>> Checked by AVG anti-virus system (http://www.grisoft.com).
>> Version: 6.0.391 / Virus Database: 222 - Release Date:
>> 19/09/2002
>>
===========================================================================
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".