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 - Mr.Marbles

Pages: 1 2 [3] 4 5 6
31
Support / Re: Mouse Movement
« on: April 02, 2007, 03:00:29 pm »
I just came across this thread while searching for a mouse input solution which would satisfy both hardware and software rendering modes (since my AWT MouseEventListeners are useless in hardware). Is there a reason why the MouseMapper in Paradroidz hasn't be added to the latest release of jPCT? It seems like a natural thing to have in the library since KeyMapper is already there. Just a thought...

32
Support / Rendering a World on Multiple Canvas!!
« on: May 18, 2006, 04:40:01 pm »
Are you using FrameBuffer.enableGLCanvasRenderer(int) ? If you are, I believe this method returns the same instance of the 'Canvas' each time it is called. So every framebuffer has exactly one Canvas. I think you'll need 4 seperate framebuffers, and then just render your world into each of them the way I was doing here:

http://www.jpct.net/forum/viewtopic.php?t=534

33
Support / 2D Primitives
« on: May 15, 2006, 03:07:48 pm »
This is probably not the best way, but you can use Primitives.getPlane() to create an Object3D plane and use setTransparency() on it. Then apply a texture that would have a drawing of your 2D shape on it.

34
Support / Rendering 1 World to 2 FrameBuffers
« on: May 09, 2006, 08:12:52 pm »
Quote from: "EgonOlsen"
However, they will be uploaded multiple times to  the graphics card when used in different contexts. That's the way OpenGL works. But it's lazy uploading, i.e. they won't be uploaded until needed in the context.


Ok I understand now, so the graphics bandwidth increases with every context that is rendered to. With the worse case being completely different contexts, which in my case shouldn't be so bad since I'm rendering the exact same scene twice.

35
Support / Rendering 1 World to 2 FrameBuffers
« on: May 09, 2006, 07:29:17 pm »
EgonOlsen,

Thank-you for the fix.

Quote

Keep in mind that the contexts don't share ressources, i.e. three framebuffers mean three times the texture memory needed.


Why is the TextureManager a Singleton? Why could it not have been instanciated in the World class and used through the World's API? This way each world would contain its own set of textures. Also, it seems excessive to allocate space for all textures everytime a FrameBuffer is created...

36
Support / Rendering 1 World to 2 FrameBuffers
« on: May 09, 2006, 02:52:48 pm »
I'm using:

Code: [Select]

viewingCanvasA = frameBufferA.enableGLCanvasRenderer(IRenderer.MODE_OPENGL);


So I guess it's GL  :?:

37
Support / Rendering 1 World to 2 FrameBuffers
« on: May 09, 2006, 02:44:18 pm »
I just tried creating a seperate world for the second FrameBuffer and I still get the same texture problems. I know the TextureManager is a Singleton, does it have any dependancy on the World object that may prevent it from being shared in two different worlds?

By the way, this is the 3rd world in my application. At first I had 2 worlds; the 1st one is rendered to its own FrameBuffer and the 2nd one was the one I rendered to 2 different FrameBuffers (as in my last post).

So now even after creating a 3rd world, I still have the same problem with the textures; they either don't appear, or are mapped to the wrong objects randomly  :?

38
Support / Rendering 1 World to 2 FrameBuffers
« on: May 09, 2006, 01:39:05 pm »
There seems to be a problem with textures when I render the same world into two different FrameBuffers. The textures don't appear on the second rendered frame buffer. Is this a known issue? Here's the code I'm using:

Code: [Select]

frameBufferA.clear();
world.renderScene(frameBufferA);
world.draw(frameBufferA);
frameBufferA.update();
frameBufferA.displayGLOnly();
viewingCanvasA.repaint();

frameBufferB.clear();
world.renderScene(frameBufferB);
world.draw(frameBufferB);
frameBufferB.update();
frameBufferB.displayGLOnly();
viewingCanvasB.repaint();


This problem only occurs with hardware rendering; in software rendering mode it works fine.

39
Support / Object3D bounds?
« on: May 02, 2006, 07:26:31 pm »
Yes I was using an older version  :oops:  Thanks for the help!

40
Support / Object3D bounds?
« on: May 02, 2006, 05:27:14 pm »
EgonOlsen,

Thanks for the help, but I'm still stuck on the conversion from 3D to 2D coordinates. The Interact2D.projectCenter3D2D() methods only convert the center point of an Object3D into screen coordinates. I don't see a way of converting an arbitrary SimpleVector.

41
Support / Object3D bounds?
« on: May 02, 2006, 02:44:33 pm »
getBoundingBox() returns the coordinates of the Object3D in object space. How could I translate this into screen coordinates :?: Would I need to first convert them into world coordinates :?:  :?:

42
Support / Object3D bounds?
« on: May 01, 2006, 03:21:01 pm »
Is there a way to get the bounds of an Object3D in world space? I need to draw a rectangle around an object in my gui. It's supposed to simulate a target tracking system. But I can't seem to find and bounds information. Java 3D had a getBoundingBox() method but I can't find a similar method in jpct.

43
Support / remove an Object from the World
« on: May 01, 2006, 02:18:55 pm »
An alternative to removing the object is to simply hide it using setVisibility() on that object. This can be done without referencing the world.

44
Support / Simulate "camera.lookAt(SimpleVector)" for an Obje
« on: April 28, 2006, 08:06:56 pm »
I've found a way to extract the angle information from the matricies:

Code: [Select]

// Vector between target and turret
SimpleVector targetTurretVec = target.getTransformedCenter().calcSub(turret.getTransformedCenter());

// Copy it for gun
SimpleVector targetGunVec = new SimpleVector(targetTurretVec);

// Make the turret rotate in the y-z-plane only
targetTurretVec.x=0;
// Make the gun rotate in the x-z-plane only
targetGunVec.y=0;

// Get rotation matrices
float [] turretMat=targetTurretVec.getRotationMatrix().getDump();
float [] gunMat=targetGunVec .getRotationMatrix().getDump();

double turretAngle = Math.acos((turretMat[0]+turretMat[5]+turretMat[10]-1)/2f);
double gunAngle = Math.acos((gunMat[0]+gunMat[5]+gunMat[10]-1)/2f);


I got the formula for extracting the angles from this site

45
Support / Simulate "camera.lookAt(SimpleVector)" for an Obje
« on: April 27, 2006, 10:21:26 pm »
EgonOlsen,

Thank you! This works very well. I've made some changes to your original code:

Code: [Select]

      // Get the vector from the turret to the target (o2 is the target)
      SimpleVector xd=turret.getTransformedCenter();
      xd.scalarMul(-1f);
      xd.add(o2.getTransformedCenter());


I replaced with:

Code: [Select]

      // Get the vector from the turret to the target (o2 is the target)
      SimpleVector xd = o2.getTransformedCenter().
                                              calcSub(turret.getTransformedCenter());


Also, my gun is attached to the turret:

Code: [Select]

turret.addChild(gun);


So I don't need to worry about the gun movement on the y-axis since it will inherit the rotation from its parent.

Just one last question about this topic. How can I calculate the delta displacement for the y and x axis. In other words, I need to know how many degrees (or radians) the turret has turned (and how high the gun has elevated) between each rendered frame. I'm displaying these readings on my gui.

Pages: 1 2 [3] 4 5 6