Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Java 3D / January 2006

Tip: Looking for answers? Try searching our database.

it seems like my scene is empty :(

Thread view: 
m.moczyrog@gmail.com - 24 Dec 2005 12:27 GMT
I'm a beginner. I know nothing more than I read in some tutorials. So
pelase be patient and forgiving ;-)

So when I try to construct the scene, the only thing I see is black and
probably empty area :(  My code is similiar to what I've seen in those
tutorials but it simply isn't working, while the examples I tried gave
good results. This is code of my createScene function:
meshX and meshY are constants. int intensity[][] keeps values of y
coordinates. These values can generally be anything between 1 and 255.

public   BranchGroup createScene()
{
  TransformGroup tg = new TransformGroup();
  BranchGroup objRoot = new BranchGroup();
  TriangleArray tri;

  for(i=0;i<meshX-1;i++)
   for(j=0;j<meshY-1;j++)
   {
       tri = new TriangleArray(3, TriangleArray.COORDINATES);
       Shape3D shape = new Shape3D();
       tri.setCoordinate(0, new Point3f(i+1, intensity[i+1][j], j));
       tri.setCoordinate(1, new Point3f(i, intensity[i][j], j));
       tri.setCoordinate(2, new Point3f(i, intensity[i][j+1], j+1));
       shape.setGeometry(tri);
       tg.addChild(shape);
       Shape3D shape2 = new Shape3D();
       tri = new TriangleArray(3, TriangleArray.COORDINATES);
       tri.setCoordinate(0, new Point3f(i+1, intensity[i+1][j+1],
j+1));
       tri.setCoordinate(1, new Point3f(i+1, intensity[i+1][j], j));
       tri.setCoordinate(2, new Point3f(i, intensity[i][j+1], j+1));
       shape2.setGeometry(tri);
       tg.addChild(shape2);

   }

  Transform3D cc3d = new Transform3D();
  cc3d.setTranslation(new Vector3f (0f ,0f ,10f ));
  tg.setTransform(cc3d);
  objRoot.addChild(tg);

  return objRoot;
}

can you help me?

Marcin
mike.jacobs@indietechnologies.com - 05 Jan 2006 21:11 GMT
Marcin, Check out this article for examples
(http://jdj.sys-con.com/read/46231.htm).  I notice that your code does
not include the full scene graph.  Be sure you have at least an ambient
light added to see your scene.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.