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.


Messages - JavaMan

Pages: 1 ... 11 12 [13] 14 15 16
181
Support / Re: Help with CollisionDetection !!!
« on: March 11, 2008, 01:55:36 pm »
Hey, thanks, that got it to work. I made the boxes smaller. That config class sure is important.!!

182
Support / Help with CollisionDetection !!!
« on: March 11, 2008, 04:06:12 am »
Hi, I am learning about collision detection. I have looked around for help with it, and I thought this code would make box1 move until it runs into box2 then stop, but the box just keeps moving with no collision. Why?
Quote
import java.awt.*;
import javax.swing.*;
import com.threed.jpct.*;
import org.lwjgl.opengl.*;
class CanTest {
   public static void main(String args[])throws Exception{
   Config.farPlane=500000;
   final JPanel top = new JPanel();

   final World w = new World();
   Object3D o = new Object3D(200);
   Object3D box1 = Primitives.getCube(60);
   Object3D box2 = Primitives.getCube(60);
   box1.build();
   box2.build();
   box1.translate(900,0,0);
   box1.translateMesh();
   box1.build();
   box1.addCollisionListener(new Lis());
   box2.addCollisionListener(new Lis());
   box1.setTransparency(0);
   box2.setTransparency(0);
   box1.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS|Object3D.COLLISION_CHECK_SELF);
   box2.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS|Object3D.COLLISION_CHECK_SELF);

   w.addObject(box1);
   w.addObject(box2);

   box1.setAdditionalColor(Color.red);
   box2.setAdditionalColor(Color.blue);

   w.setAmbientLight(200,200,200);
   w.newCamera();
   Camera cam = w.getCamera();
   cam.moveCamera(Camera.CAMERA_MOVEOUT,5000);
   cam.moveCamera(Camera.CAMERA_MOVERIGHT,800);

   final FrameBuffer b = new FrameBuffer(800,600,FrameBuffer.SAMPLINGMODE_NORMAL);
   b.enableRenderer(IRenderer.RENDERER_OPENGL,FrameBuffer.SAMPLINGMODE_NORMAL );
   b.disableRenderer(IRenderer.RENDERER_SOFTWARE);

   box1.enableCollisionListeners();
   box2.enableCollisionListeners();

   int i = 0;
   while(i<5000){
         b.clear();
         w.renderScene(b);
         w.draw(b);
         b.update();
         b.displayGLOnly();
   Thread.sleep(100);
   SimpleVector v = box1.checkForCollisionSpherical(new SimpleVector(-10f,0,0),10f);
   box1.translate(v.x,v.y,v.z);
   System.out.println("" + v.x + " " + v.y + " " + v.z);
   }


   }
}

class Lis implements CollisionListener {
   public void collision(CollisionEvent e){
      System.out.println("OUCH!!!!!!!!!!!!");
   }








   public boolean requiresPolygonIDs(){
      return false;
   }
}



Thanks for any help! I really am stumped. ???

183
Support / Re: Any java 3d sound api instead of OpenAL
« on: March 11, 2008, 03:35:06 am »
Cool! Everything is organized on that page, and easy to find. (Maybe I should organize the ObjectEditor area :-[)

184
Support / Re: Any java 3d sound api instead of OpenAL
« on: March 10, 2008, 05:33:26 pm »
Maybe you should add your code as a project in the projects area. That way visitors to the site can see there are some sound classes specifically for jpct.  ::)

185
Support / Re: Problem with AWTGLRenderer
« on: March 09, 2008, 02:11:05 am »
No, that doesn't do anything. This is so weird. When I first run the program, like after the pc has been rebooted, it removes the canvas without any problems, but upon running it the second time: bang the error.

I ran it on a different laptop than I have been using and it runs ok.

I think I'll just use the GL renderer, instead of trying to support both. Maybe in a new version of lwjgl this will be worked out.  ::) Thanks for the help:)

186
Support / Re: Problem with AWTGLRenderer
« on: March 08, 2008, 12:05:23 am »
Quote
Which LWJGL version are you using?

I tried out using jpct1.15 and lwjgl that came with it as well as jpct1.16 and its lwjgl.

Quote
Does it help to make the JPanel invisible before trying to remove the canvas?

Unfortunately, not; well at least not all the time. Before I tried that out, the it always crashed. Now it only crashes sometimes. ??? And other times, it removes it and all goes well.

Also, if this helps any, I tried out creating a AWTGLCanvas(with the lwjgl AWTGLCanvas constructor) and adding it to the panel. I used the software renderer to render into it, and that worked fine along with removing it.

187
Support / Re: Problem with AWTGLRenderer
« on: March 07, 2008, 09:25:48 pm »
With that code, it still crashes right when I try to remove the canvas. It even crashes when I try to remove the JPanel.

Quote
BTW: What is the purpose of the new FrameBuffer instance in that code?

I forgot that to go to software rendering all I have to do is call disableRenderer(...). I was going to create a whole new FrameBuffer.  ??? Also, I put that new FrameBuffer in the wrong spot; it should go after removing the canvas. This isn't my real code, just what my code does.

I wonder if it is something with the lwjgl, because removing a non-gl-canvas from a jpanel works fine.

188
Support / Re: Problem with AWTGLRenderer
« on: March 07, 2008, 01:26:10 am »
Quote
In fact I guess that many people has this problem when trying to quit jpct apps since using java 6.
Huh,thats weird. Maybe I'll try it out with jre 1.5 instead.


I tried out the program with 1.5: the app runs slower and crashes. Joy...

189
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]

190
Support / Re: How to setup environment
« on: March 06, 2008, 04:08:56 pm »
I would suggest exactly what Jonas said.

If you want software use framebuffer.display(yourjpanelorcanvas.getGraphics())

If you need hardware then call framebuffer.enableGLRenderer() put the Canvas that it returns into your gui and starting rendering into it.

Also,  I wouldn't try changing renderers while running the program. The renderer you start out with Software or OpenGL is the renderer you should stay with. Sometimes changing the renderer works fine, and other times it makes my program crash. ???

Jman



191
Support / Re: Contrast due to scaling
« on: March 05, 2008, 03:46:40 pm »
Maybe you have two lights in the world, and one is behind the camera? Or your light is super bright, and you need to move it very far away to see any change in brightness?


192
Projects / Re: Object3D Editor
« on: March 02, 2008, 11:53:39 pm »
Hi,
I posted a new version with some fixes.
Quote
Some menus are not usable on 1280*1024, because the 3d canvas is rendered on top them them.
I noticed that, but forgot about fixing. It is now fixed.

Quote
Apart from that, i'm unable to add create something that is actually visible in the 3d canvas. Can you give short step-by-step-introduction of how to add a primitive and view it (for example a cube)? I managed to add a cube (at least i think so), it's just that i don't see it in the canvas!?

Sorry, I forgot to say that everything in the previous version did not respond how it seemed how it should respond. I uploaded a new version, and anything that does not respond, is disabled or says <>NOT YET IMPLEMENTED<> beside its text. So, actually when you clicked cube, nothing happened. In this version, all that can be added is triangles, but I hope to allow more objects to be added. 


Jman
If anyone downloads it, and you have a question, just ask...
The download at the top of the page reflects the latest changes.


193
Projects / Re: Object3D Editor
« on: March 02, 2008, 05:01:06 am »
Hi,
I uploaded the latest version of the program. It isn't a lot different than the previous version except that how I have the program looking is how it is going to stay. I'm not going to change it again. If someone downloads the app, and has a question about how to do something, just post it here, and I will respond asap.

194
Projects / Re: Labyrinth Z
« on: February 27, 2008, 03:08:35 am »
Hey,
Glad you are making progress with your game. I think I'll try it out when you get it done.

I don't mean to drag out the installer discussion, but I also found an installer called install4j.
http://www.download.com/Install4j/3000-2417_4-10208786.html?tag=lst-1
If you don't use windows, then you can't use this download, but maybe the download from the site is the same. Anyways, on the cnet site it says the limitations for the install4j is just nagware.
Jman

195
Projects / Re: Labyrinth Z
« on: February 24, 2008, 11:14:00 pm »
I was looking around for installers, and I ran across that one. It looks good for distributing on Window, Linux, and Unix, and I hope they will add support for Mac soon.  I don't have a mac, just windows, but since I program in java, it would be nice to deploy the app for all the major platforms. I may use that for my project when I get it done. Also, I don't know if your game will be opensource, but if it is, I found this installer that is free for open source projects.
http://bitrock.com/products_installbuilder_opensource.html

Quote
And I was wondering if you had tried the Eclipse editor and what you thought about it.

No, I never used it;I just heard about it in a java robotics forum.
I've used JCreator, and Netbeans. JCreator is nice, NetBeans is a little slow, and the GUI builder isn't that great.

Pages: 1 ... 11 12 [13] 14 15 16