Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - JavaMan

Pages: 1 [2]
16
Support / Problem with AWTGLRenderer
« on: March 07, 2008, 12:44:35 am »
Hi, I am trying to get a program to render into a Canvas with the GLRenderer, and then when the container around the Canvas becomes bigger, I need to remove the canvas from its container, create a new framebuffer, and add the new canvas from the framebuffer into the container where the old canvas was. I have everything working up to the point where the canvas is removed. Whenver I try to remove the canvas, the program crashes: no exception or anything just Windows tells me java.exe has caused an error and needs to close. I created some code that is like my real code, and creates the crash.
Quote
import java.awt.*;
import javax.swing.*;
import com.threed.jpct.*;
class CanTest {

   public static void main(String args[]){
   final JPanel top = new JPanel();

   World w = new World();
   Object3D o = new Object3D(200);
   o.addTriangle(new SimpleVector(0,0,0),new SimpleVector(0,300,0),new SimpleVector(300,0,0));
   o.build();
   w.addObject(o);
   w.setAmbientLight(200,200,200);
   w.newCamera();
   Camera cam = w.getCamera();
   cam.moveCamera(Camera.CAMERA_MOVEOUT,100);
   
   JFrame f = new JFrame();
   f.setLayout(new GridLayout(1,1));
   f.add(top);
   f.setVisible(true);
   f.setSize(500,500);
   top.setBackground(Color.blue);
        try{ Thread.sleep } catch(Exception e){}
   FrameBuffer b = new FrameBuffer(top.getWidth(),top.getHeight(),FrameBuffer.SAMPLINGMODE_NORMAL);
   final Canvas c = b.enableGLCanvasRenderer();
   b.disableRenderer(IRenderer.RENDERER_SOFTWARE);
   top.setLayout(new GridLayout(1,1));
   top.add(c);
   int i = 0;
   i=0;
   while(i<5000){
         b.clear();
         //System.out.println("RENDERSCENE");
         w.renderScene(b);
         //System.out.println("DRAW");
         w.draw(b);
         //System.out.println("UPDATE");
         b.update();
         //System.out.println("GLONLY");
         b.displayGLOnly();
         //System.out.println("CANVAS__REPAINT");
         c.repaint();
         System.out.println("" + ++i);
   }
   b.dispose();
         FrameBuffer framebuffer =new FrameBuffer(top.getWidth(),top.getHeight(),FrameBuffer.SAMPLINGMODE_NORMAL);   
         System.out.println("E");
         System.out.println("l1");
            framebuffer.disableRenderer(IRenderer.RENDERER_SOFTWARE);
   System.out.println("About to crash...");
   /** Uncommenting the line below makes the program crash. */
   //top.remove(c);
   
   /**It doesn't matter is you try this. Still the same result: a crash*/
   /*
   SwingUtilities.invokeLater(new Runnable(){
      public void run(){
         top.remove(c);
      }
   });
   */
   }
}

Anybody, know why this happens? ???
JMan

I tried this little program on another computer, and the jre printed out this message before exiting the program, but windows didn't put up that error dialog
Quote
About to crash...
#
# An unexpected error has been detected by Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x696a0508, pid=3752, tid=2748
#
# Java VM: Java HotSpot(TM) Client VM (1.6.0_03-b05 mixed mode, sharing)
# Problematic frame:
# C  [nvoglnt.dll+0x1a0508]
#
# An error report file with more information is saved as hs_err_pid3752.log
#
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp
#

[error occurred during error reporting, step 270, id 0xc0000005]

17
Support / Serializing Object3Ds to file
« on: February 10, 2008, 09:34:23 pm »
Hi,
I am trying to write an Object3D to a file to be loaded later by another program. The serializing of the Object3D to a file works fine, but when I try to read the file and cast it into an Object3D it gives me this error

C:\ObjectEditor>java Viewer h
Exception in thread "main" java.io.WriteAbortedException: writing aborted; java.
io.NotSerializableException: com.threed.jpct.PolygonManager
        at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1333)
        at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:19
  45)
        at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1869)

        at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1
753)
        at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
        at Viewer.main(Viewer.java:21)

There is more to the error output, but what it is saying is that the PolygonManger is not serializable. I know this, but how do you serialize an Object3D without its PolygonManger? The object that I am trying to serialize has gotten getPolygonManger() called on it. When the Object has not had getPolygonManager() called on it, the Object3D serializes fine.
I tried out creating another Object3D and setting this object's mesh to the object that am I trying to serialize. Then I serialize the new object3d, and it obviously works fine, but all my textures naturally disappear. I don't want that. So, how do I serialize an object to a file with all its texture information?
thanks
jman

18
Support / ArrayOutofBounds exception probelm
« on: January 20, 2008, 10:17:24 pm »
Hi, In my Object3DEditor program I am getting a strange problem when I add triangles to objects in the program. The probelm doesn't always happen just here and there, but it when it happens, it happens after adding a triangle to an object3d in the world. Here is the exception

Exception in thread "Thread-2" java.lang.ArrayIndexOutOfBoundsException: 11
        at com.threed.jpct.Object3D.render(Unknown Source)
        at com.threed.jpct.World.renderScene(Unknown Source)
        at Object3Ds.run(Object3DEditor.java:65)
        at java.lang.Thread.run(Unknown Source)

Any ideas as to what is happening here? The Thread-2 is the Thread that is rendering the world into a JPanel.
thanks v

19
Projects / Object3D Editor
« on: January 16, 2008, 04:25:22 am »
Current Status May 29,08>>I have uploaded a new version of the Editor. This version fixes some problems.

This project is a for creating a simple 3D modeler program for Object3Ds.

With the current version you can create an Object3D from scratch or open up any Object that jpct can load and edit it(3DS,ASC,MD2...).


By editing I mean: setting polygon textures, setting whole object textures, changing polygon vertex data, and adding pre-built objects(cubes, triangles, spheres, planes...) to an object. Plus a few more settings.
 
When you have the object looking how you want it, you can save a serialized version of the object's mesh, a xml file that contains just the object specified by the jpct dtd, or a xml file that cotains jpct xml file, and extra information that you set in the editor. This third option will copies the necessary image files in to the directory in which you save the xml file. There is a jar file(with class files in it) that you can use to load the object for your jpct program from the xml file. The source is also there.




This is the current version of the program. It has everything implemented! If you have find a bug, please tell me!
This download contains all the files necessary to run the program. It also contains the source.

www.geocities.com/thejavaman2/Object3DEditor.zip

java -cp Object3DEditor.jar -splash:splash.jpg -Xmx400m Controller
The number after the Xmx option is the minimum amount of memory necessary to run the program. If you are running the program with large objects, and it crashes with a java heap space exception, I suggest you increase the number.

If anyone downloads it, and you have a question, just ask.



Here the program is running with some transparent triangles with textureinfo.


Here is a quick step-by-step to create an object and add a triangle to it.
1: Click New>Object3D Basic
2: fill in the max triangles and the name of the Object3D as seen here.


3: Click on the corresponding button in the left panel which has the title of your new object3d as its title.
    The scroll ares will then update to reflect the selected object that the button represents.
4: Scroll down in the left scroll area and click the triangle button.


5. Then fill in the values for the 1st, 2nd, and 3rd vectors. The row next to the 1 represent the values for what you could picture as in addTriangle(1strow,2ndrow,3rdrod); Then click the done button.



Here are some instructions on how to move the camera.


Some instructions on changing vertex data of polygon.


Info, on texture creation:

20
Support / Glass or shine on objects?
« on: November 25, 2007, 02:09:02 am »
Quick question:
Can I make objects shiny? Like how light sometimes shines on an object( in the real world) and it creates a glare or shine on the object. I can't see how to do this.
THx
V

21
Support / Textures on triangles and textures in general
« on: November 09, 2007, 08:16:44 pm »
Hi I have a quick question for creating objects from triangles and applying textures to them. I created a "box" from primitives.getBox and I was able to apply a texture to it, but how do I do it to an object made from triangles? When I call object3D.setTexture(...) it will apply it to the box but not to the triangle! I also tried putting a TextureInfo refernece into the Object3D.addTriangle but it still doesn't work.

Also, I'm not that clear on textures anyway. Is there some post on this forum that textures were explained or could someone explain them to me? I know texture is what we see when the object is in view and every object has a dummy texture, but about environment mapping base texture.
Thanks
Hope this isn't too much for one post.
V

I try not put two posts so close together next time :-\

22
Support / Jpct tutorial
« on: October 23, 2007, 02:12:59 pm »
Hi,
In searching for a java 3d engine, I found jpct. I looked at the manual and it seems that this is exactly the way in which I want to create 3d programs. Where can I find a tutorial on jpct? I have searched on the net and I can't find one anywhere. It seems that a lot of people know how to use jpct, but where did you learn?
Thanks
JM

Pages: 1 [2]