[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Java3Djp:01259] Re: Re: テクスチャーの張り替え時に関する問題
★★★★★★★テレビでも紹介された あの【eオークション】★★★★★★★★
「どんな商品が出品されているの??」―――― た・と・え・ば
●“横浜ベイシェラトンホテルスイートルーム” 通常¥85,000を¥25,000〜!
●“ソニーデジタルカメラ 35万画素”を¥15,000〜! など多数。
♪豪華賞品があたるキャンペーンも実施中♪
いろいろ商品を取り揃えて、あなたの「入札」をお待ちしています!
★★★ネット上オークションで最先端のお買い物! http://www.eac.ne.jp★★★
こんにちは.
藤原です.
known bugs にそれらしきものが無かったので.
Yukio Andoh wrote:
>
> java3d-beta@xxxxxxxxxx
へ,バグレポートを送りました.
同じ文面をこちらのメーリングリストにも送ります.
# ソースがこちらへ投稿したものと若干違います.
ありがとうございました.
======= レポート ==================================================
<< Synopsis >>
Memory consumption increases when I set a texutre object on two or
more view objects over and over.
<< Description of the Problem >>
Texture mapping problem.
I attempt to set a texutre object on view objects(sphere, box, and so
on) with following conditions.
・ texture object is refleshed in succession.
・ two view objects share only one texture object.
Finaly, "OutOfMemoryError" occurs.
I consider that texture memory is not freed.
I could not find out the problem with following conditions.
・ texture object is refleshed in succession.
・ a view object is textured a texture object.
・ another view object is textured a texture object is made from
"Texture#cloneNodeComponent()" method.
I consider that two view objects should be able to share one texture
object.
<< example program >>
create a texture object from "1.jpg" file when a mouse click on the
frame.
And two sphere objects are textured the texture object.
--- TFlipTexture.java ----------------------------------------------
// prepare named "1.jpg" file.
// texture object make from the file.
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import javax.media.j3d.*;
import com.sun.j3d.utils.image.*;
import com.sun.j3d.utils.universe.SimpleUniverse;
import com.sun.j3d.utils.geometry.*;
import javax.vecmath.*;
public class TFlipTexture extends Frame
{
Toolkit mTk = Toolkit.getDefaultToolkit();
Canvas3D mCanv = new Canvas3D(null);
String mImgDir = "./image/1.jpg"; // "1.jpg" image lacation
Image mImg = null;
Appearance mSph1Apr = null;
Appearance mSph2Apr = null;
public TFlipTexture(){
super("texture");
SceneGraph();
SetupListener();
SetupFrame();
}
public void SetupFrame(){
add(mCanv);
setSize(600, 480);
setVisible(true);
}
public void SetupListener(){
addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
setVisible(false);
dispose();
}
public void windowClosed(WindowEvent e){
System.exit(0);
}
});
// read a picture file named "1.jpg".
// actualy, read different picture in succession.
// but, make a texture from a picture for easy code
mImg = mTk.getImage(mImgDir);
mCanv.addMouseListener(new MouseAdapter(){
public void mouseClicked(MouseEvent event)
{
try{
// update texture
TextureLoader texLoader = new TextureLoader(mImg, mCanv);
Texture tex = texLoader.getTexture();
mSph1Apr.setTexture(tex);
mSph2Apr.setTexture(tex);
System.gc();
}
catch(NullPointerException except){
except.printStackTrace();
}
}
});
}
public void SceneGraph()
{
SimpleUniverse univ = new SimpleUniverse(mCanv);
BranchGroup rootBG = new BranchGroup();
TransformGroup rootTG = new TransformGroup();
mSph1Apr = new Appearance();
Sphere sphere1 = new Sphere(0.4f,
Primitive.GENERATE_NORMALS
| Primitive.GENERATE_TEXTURE_COORDS,
mSph1Apr);
mSph1Apr.setCapability(Appearance.ALLOW_TEXTURE_WRITE);
TransformGroup sh1TG = new TransformGroup();
Transform3D tran1 = new Transform3D();
tran1.setTranslation(new Vector3f(-0.4f, 0.0f, 0.0f));
sh1TG.setTransform(tran1);
sh1TG.addChild(sphere1);
rootTG.addChild(sh1TG);
mSph2Apr = new Appearance();
Sphere sphere2 = new Sphere(0.4f,
Primitive.GENERATE_NORMALS
| Primitive.GENERATE_TEXTURE_COORDS,
mSph2Apr);
mSph2Apr.setCapability(Appearance.ALLOW_TEXTURE_WRITE);
TransformGroup sh2TG = new TransformGroup();
Transform3D tran2 = new Transform3D();
tran2.setTranslation(new Vector3f(0.4f, 0.0f, 0.0f));
sh2TG.setTransform(tran2);
sh2TG.addChild(sphere2);
rootTG.addChild(sh2TG);
univ.getViewingPlatform().setNominalViewingTransform();
rootBG.addChild(rootTG);
univ.addBranchGraph(rootBG);
}
public static void main(String[] arg)
{
new TFlipTexture();
}
}
--------------------------------------------------------------------
<< Configration information >>
WindowsNT4.0(SP5) + Internet Explorer4.0(SP2)
Pentium2 450MHz
Memory : 256M
HDD : 17G
Matrox MillenniumG200AGP
<< Text of any error message(s) that appeared >>
-------------- error message ---------------------------------------
Exception occurred during event dispatching:
java.lang.OutOfMemoryError:
at
javax.media.j3d.ImageComponent2DRetained.set(ImageComponent2DRetained.java:52)
at
javax.media.j3d.ImageComponent2D.<init>(ImageComponent2D.java:60)
at
com.sun.j3d.utils.image.TextureLoader.getTexture(TextureLoader.java:374)
at TFlipTexture$2.mouseClicked(TFlipTexture.java, Compiled
Code)
at java.awt.Component.processMouseEvent(Component.java,
Compiled Code)
at java.awt.Component.processEvent(Component.java, Compiled
Code)
at java.awt.Component.dispatchEventImpl(Component.java,
Compiled Code)
at java.awt.Component.dispatchEvent(Component.java, Compiled
Code)
at java.awt.EventQueue.dispatchEvent(EventQueue.java, Compiled
Code)
at
java.awt.EventDispatchThread.pumpOneEvent(EventDispatchThread.java,
Compiled Code)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:92)
at
java.awt.EventDispatchThread.run(EventDispatchThread.java:83)
Exception occurred during event dispatching:
java.lang.OutOfMemoryError:
at
javax.media.j3d.ImageComponent2DRetained.set(ImageComponent2DRetained.java:52)
at
javax.media.j3d.ImageComponent2D.<init>(ImageComponent2D.java:60)
at
com.sun.j3d.utils.image.TextureLoader.getTexture(TextureLoader.java:374)
at TFlipTexture$2.mouseClicked(TFlipTexture.java, Compiled
Code)
at java.awt.Component.processMouseEvent(Component.java,
Compiled Code)
at java.awt.Component.processEvent(Component.java, Compiled
Code)
at java.awt.Component.dispatchEventImpl(Component.java,
Compiled Code)
at java.awt.Component.dispatchEvent(Component.java, Compiled
Code)
at java.awt.EventQueue.dispatchEvent(EventQueue.java, Compiled
Code)
at
java.awt.EventDispatchThread.pumpOneEvent(EventDispatchThread.java,
Compiled Code)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:92)
at
java.awt.EventDispatchThread.run(EventDispatchThread.java:83)
Exception occurred during event dispatching:
java.lang.OutOfMemoryError:
at java.awt.image.DataBufferInt.<init>(DataBufferInt.java:48)
at java.awt.image.Raster.createPackedRaster(Raster.java:404)
at
ava.awt.image.DirectColorModel.createCompatibleWritableRaster(DirectColorModel.java:637)
at java.awt.image.BufferedImage.<init>(BufferedImage.java,
Compiled Code)
at
com.sun.j3d.utils.image.TextureLoader.createBufferedImage(TextureLoader.java,
Compiled Code)
at
com.sun.j3d.utils.image.TextureLoader.<init>(TextureLoader.java:161)
at
com.sun.j3d.utils.image.TextureLoader.<init>(TextureLoader.java:124)
at TFlipTexture$2.mouseClicked(TFlipTexture.java, Compiled
Code)
at java.awt.Component.processMouseEvent(Component.java,
Compiled Code)
at java.awt.Component.processEvent(Component.java, Compiled
Code)
at java.awt.Component.dispatchEventImpl(Component.java,
Compiled Code)
at java.awt.Component.dispatchEvent(Component.java, Compiled
Code)
at java.awt.EventQueue.dispatchEvent(EventQueue.java, Compiled
Code)
at
java.awt.EventDispatchThread.pumpOneEvent(EventDispatchThread.java,
Compiled Code)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:92)
at
java.awt.EventDispatchThread.run(EventDispatchThread.java:83)
-------------- error message ---------------------------------------
I recognized it via "window NT task manager".
And see "process tab" - "image name" - "java.exe".
thank you.
--
----------------
Fujiwara Isao