Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (535)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  [Need Help]Java3D mipmap problem!  (Read 1211 times)
0 Members and 1 Guest are viewing this topic.
Offline jiahan

Junior Newbie




Java games rock!


« Posted 2005-03-23 15: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...
Offline misterX

Junior Member




java forever!


« Reply #1 - Posted 2005-03-30 18:26:06 »

is your texture size a power of 2?
(if not, that may be the source of the error)
Offline jiahan

Junior Newbie




Java games rock!


« Reply #2 - Posted 2005-03-31 03: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
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline shawnkendall

Senior Member





« Reply #3 - Posted 2006-04-25 18:51:40 »

DId you ever resolve this error?

I am getting it all of a sudden too.

Thanks for any help!

Shawn Kendall
Cosmic Interactive, LLC
http://www.facebook.com/BermudaDash
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

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

The first screenshot will be displayed as a thumbnail.

E.R. Fleming (15 views)
2014-07-29 03:07:13

E.R. Fleming (4 views)
2014-07-29 03:06:25

pw (39 views)
2014-07-24 01:59:36

Riven (39 views)
2014-07-23 21:16:32

Riven (26 views)
2014-07-23 21:07:15

Riven (28 views)
2014-07-23 20:56:16

ctomni231 (59 views)
2014-07-18 06:55:21

Zero Volt (50 views)
2014-07-17 23:47:54

danieldean (42 views)
2014-07-17 23:41:23

MustardPeter (44 views)
2014-07-16 23:30:00
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
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!