Java-Gaming.org Hi !
Featured games (81)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (119)
games submitted by our members
Games in WIP (576)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Java Game APIs & Engines / Java 3D / [Xj3D API problem]No Background, use the X3DLoader on: 2005-03-31 07:19:39
I use X3Dloader to import x3d scene to construct Java3D scene graph from x3dv file~
And this x3d scene has Background node, which to pasted full image around the 3D world.
But I can't see any background in Java3D world, when I use X3DLoader to import that X3D scene.
And then I use the browser(in Java3D render) bundled with Xj3D API, to view the X3D file....I can see the background.

I think the X3DLoader is already load the background node into java3D scene, but the background node's shape is black(shade color), and no image pasted on these shape.
So how to use X3DLoader to load X3D scene's background correctly??Does everyone familiar with Xj3D API can help me.
thanks~

My JDK is 1.5, My Java3D API is 1.3.1, Xj3D API is M10

x3dv code:
---------------------------------------------------------
Background {
backUrl [ "ocean_3_back.jpg" ]
bottomUrl [ "ocean_3_bottom.jpg" ]
frontUrl [ "ocean_3_front.jpg" ]
groundAngle [ 0.1, 1.309, 1.571 ]
groundColor [ 0 0 0, 0 0.1 0.3, 0 0.2 0.5, 0 0.3 0.8 ]
leftUrl [ "ocean_3_left.jpg" ]
rightUrl [ "ocean_3_right.jpg" ]
skyAngle [ 0.1, 0.15, 1.309, 1.571 ]
skyColor [ 0.4 0.4 0.1, 0.4 0.4 0.1, 0 0.1 0.3, 0 0.2 0.6, 0.8 0.8 0.8 ]
topUrl [ "ocean_3_top.jpg" ]
}
--------------------------------------------------------

Java code
--------------------------------------------------------
BranchGroup worldRoot = new BranchGroup();
int flag = X3DLoader.LOAD_ALL;
X3DLoader loader = new X3DLoader(flag);
Scene scene = null;

scene = loader.load("x3dv/background/background.x3dv");
worldRoot.addChild(scene.getSceneGroup());
worldRoot.compile();
universe.addBranchGraph(worldRoot);
---------------------------------------------------------
2  Java Game APIs & Engines / Java 3D / Re: [Need Help]Java3D mipmap problem! on: 2005-03-31 01:33:53
Yes, my texture is power of 2, and if I use beas level model, it's all working fine....
Does everyone know why? Huh
3  Java Game APIs & Engines / Java 3D / [Need Help]Java3D mipmap problem! on: 2005-03-23 14:03:44
When I use mipmap mode in Texture component, I will get following error message..
----------------------------------------
java.lang.NullPointerException
   at javax.media.j3d.TextureRetained.checkSizes(TextureRetained.java:406)
   at javax.media.j3d.TextureRetained.setLive(TextureRetained.java:943)
   at javax.media.j3d.TextureUnitStateRetained.setLive(TextureUnitStateRetained.java:471)
   at javax.media.j3d.AppearanceRetained.setLive(AppearanceRetained.java:927)
   at javax.media.j3d.Shape3DRetained.doSetLive(Shape3DRetained.java:1066)
   at javax.media.j3d.Shape3DRetained.setLive(Shape3DRetained.java:891)
   at javax.media.j3d.GroupRetained.childDoSetLive(GroupRetained.java:2125)
   at javax.media.j3d.GroupRetained.doSetLive(GroupRetained.java:2180)
   at javax.media.j3d.TransformGroupRetained.setLive(TransformGroupRetained.java:549)
   at javax.media.j3d.GroupRetained.childDoSetLive(GroupRetained.java:2125)
   at javax.media.j3d.GroupRetained.doSetLive(GroupRetained.java:2180)
   at javax.media.j3d.BranchGroupRetained.setLive(BranchGroupRetained.java:160)
   at javax.media.j3d.GroupRetained.childDoSetLive(GroupRetained.java:2125)
   at javax.media.j3d.GroupRetained.doSetLive(GroupRetained.java:2180)
   at javax.media.j3d.TransformGroupRetained.setLive(TransformGroupRetained.java:549)
   at javax.media.j3d.GroupRetained.childDoSetLive(GroupRetained.java:2125)
   at javax.media.j3d.GroupRetained.doSetLive(GroupRetained.java:2180)
   at javax.media.j3d.BranchGroupRetained.setLive(BranchGroupRetained.java:160)
   at javax.media.j3d.GroupRetained.childCheckSetLive(GroupRetained.java:2132)
   at javax.media.j3d.GroupRetained.checkSetLive(GroupRetained.java:1527)
   at javax.media.j3d.GroupRetained.checkSetLive(GroupRetained.java:1448)
   at javax.media.j3d.GroupRetained.doAddChild(GroupRetained.java:483)
   at javax.media.j3d.GroupRetained.addChild(GroupRetained.java:456)
   at javax.media.j3d.Group.addChild(Group.java:266)
------------------------------------------------------

The code(I use setInterleavedVertexBuffer(J3DBuffer) to set geometry's vertex data):-----------------------------------------
Appearance a = new Appearance();
       Material m = new Material(new Color3f(0.6f,0.6f,0.6f), new Color3f(0,0,0),
               new Color3f(1,1,1), new Color3f(0.8f,0.8f,0.8f),32);
       TextureLoader loader = new TextureLoader(image,"RGBA",
               TextureLoader.BY_REFERENCE|TextureLoader.GENERATE_MIPMAP, null);
       ImageComponent2D tImage = loader.getImage();
       int textureSize =
               RenderingCapabilityManager.getTextureSize(new Dimension(tImage.getWidth(),
               tImage.getHeight()));
       Dimension size = new Dimension(textureSize, textureSize);
       Shape3D shape = new Shape3D(this.createPlane(v), a);
       Texture2D texture =
               new Texture2D(RenderingCapabilityManager.getMipMapMode(),
               Texture.RGBA,size.width, size.height);
       int imageLevel =0;
       boolean mipMode =
               RenderingCapabilityManager.getMipMapMode()
               ==Texture.MULTI_LEVEL_MIPMAP;
       TextureAttributes ta = new TextureAttributes();
       TextureUnitState[] tus = new TextureUnitState[1];
       tus[0] =  new TextureUnitState(texture, ta, null);
       PolygonAttributes pa =
               new PolygonAttributes(PolygonAttributes.POLYGON_FILL,
               PolygonAttributes.CULL_NONE, 0, true);
       TransparencyAttributes tta = new TransparencyAttributes(TransparencyAttributes.NICEST, 1f);
       ta.setTextureMode(TextureAttributes.REPLACE);
       
       pa.setUserData(false);//don't modify PolygonAttributes
       a.setPolygonAttributes(pa);
       a.setTransparencyAttributes(tta);
       do{
           tImage = loader.getScaledImage(size.width, size.height);
           texture.setImage(imageLevel++, tImage);
           System.out.println(tImage);
           size.width >>=1;
           size.height >>=1;
       }while(size.width>1 && size.height >1 &&
               mipMode);
       texture.setMaximumLevel(imageLevel-1);
       //System.out.println(texture.getImage(imageLevel-1));
       a.setTextureUnitState(tus);
       a.setMaterial(m);
-------------------------------------------
But if I did't use mipmap mode, use baselevel mode, every thing is working fine..
I do't know why...Is everyone can help me~

My JDK is 1.5,Java3D API is 1.3.1(OpenGl) and video card is Geforce6800 Ultra
Thanks...
4  Java Game APIs & Engines / Java 3D / Re: Need help:How to use SceneGraphIO in Java3D on: 2005-01-21 04:35:46
My JDK is 1.5 and Java3D API is 1.3.1
thanks~
5  Java Game APIs & Engines / Java 3D / Need help:How to use SceneGraphIO in Java3D on: 2005-01-21 04:25:01
I had try many times,but when I use
SceneGraphFileWriter writer = new SceneGraphFileWriter(file,universe,true,"test",null);to output scenegraph to the file,I will get node's attributes can't be read CapabilityNotSetException, and then I set all node's attributes' capability to ALLOW_READ.
Finally I get can't get RestrictedAccessException
so.....I think there is other method should be call,before I use SceneGraphFileWriter to export scenegraph..
If someone knows how to use, or sample code can be see.
Please tell me, thanks~
Pages: [1]
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Longarmx (38 views)
2014-10-17 03:59:02

Norakomi (29 views)
2014-10-16 15:22:06

Norakomi (24 views)
2014-10-16 15:20:20

lcass (28 views)
2014-10-15 16:18:58

TehJavaDev (56 views)
2014-10-14 00:39:48

TehJavaDev (55 views)
2014-10-14 00:35:47

TehJavaDev (46 views)
2014-10-14 00:32:37

BurntPizza (64 views)
2014-10-11 23:24:42

BurntPizza (36 views)
2014-10-11 23:10:45

BurntPizza (78 views)
2014-10-11 22:30:10
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!