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 - AGP

Pages: 1 ... 11 12 [13] 14
Support / Hardware jpct-lwjgl Applets
« on: April 23, 2009, 12:33:47 am »
I'm trying to make hardware jpct-lwjgl applets that use the joystick and 3D hardware. All three of the first ones have failed to render anything to the screen (except for when on the third one I was using jpct's software renderer). Check out the code of this incredibly simple applet and remember it worked on software rendering (without the canvas). As it is, I get a black screen (nothing renders). By the way, although I'm only using ambient light on this one, the other two had other lights positioned around the world.

Code: [Select]
import java.applet.*;
import java.awt.*;
import com.threed.jpct.*;
import com.threed.jpct.util.Light;
import org.lwjgl.opengl.*;
import org.lwjgl.input.*; //JOYSTICK AND OPENGL-MODE KEYBOARD

public class SimpleApplet3D extends Applet implements Runnable {
      private Object3D object;
      private World theWorld;
      private FrameBuffer buffer;
      private Camera theCamera;
      private boolean keepGoing;
      private Controller joystick;
      private Canvas theCanvas;

      public void init() {
object = Loader.load3DS("c:/MyPrograms/3D/SimpleApplet/Girl.3DS", 1f)[0];
buffer = new FrameBuffer(800, 600, FrameBuffer.SAMPLINGMODE_NORMAL);
Config.maxPolysVisible *= 3;
theWorld = new World();
theCamera = theWorld.getCamera();
this.add(theCanvas = buffer.enableGLCanvasRenderer());
Controllers controllers = new Controllers();
try {
      if (controllers.getControllerCount() > 0) {
joystick = controllers.getController(0);
System.out.println("Got the joystick. Its name: "+joystick.getName());
catch (org.lwjgl.LWJGLException e) {}
theWorld.setAmbientLight(65, 65, 65);
keepGoing = true;
      public void start() {
Thread appletLoop = new Thread(this);
      private void draw() {
// buffer.displayGLOnly();
      public void run() {
while (keepGoing) {
      if (joystick != null) {
theCamera.moveCamera(Camera.CAMERA_MOVEIN, joystick.getYAxisValue());
      try {
      catch (InterruptedException e) {}
      public void stop() {
keepGoing = false;
      public void destroy() {}

Support / lwjgl Joystick
« on: April 16, 2009, 08:20:45 pm »
I have two programs. One uses an AWT window and initializes the FrameBuffer like this:
Code: [Select]
buffer = new FrameBuffer(width, height, SAMPLINGMODE_NORMAL);
Then (after World.renderScene(buffer) and World.draw(buffer)) calls buffer.display(Graphics). The other, like this:
Code: [Select]
buffer = new FrameBuffer(width, height, SAMPLINGMODE_HARDWARE_ONLY);
then makes only buffer.displayGLOnly() calls. Oddly, the first program initializes and uses the lwjgl joystick succesfully whereas the second one can't get past controllers.create()! Why oh why?

Support / Midi Volume (Not jPCT But Java)
« on: February 03, 2009, 05:48:13 pm »
I've read everything on the subject that I could find by searching Google. Figured somebody here might know. I cannot, for the life of me, change the volume of the midi playback in my program. The following is my code. The last part (before the call to start()) is my attempt at discovering which Synthesizer is attached to the Sequencer. And the very last nested loop was an attempt to change everyone's volume. By the way, if my test for synthesizer.getDefaultSoundbank() == null is valid, I'm using the software synthesizer on my computer.

Code: [Select]
        private void playMidi(String fileName) {
try {
     midiPlayer = MidiSystem.getSequencer(true);
     Synthesizer synthesizer = MidiSystem.getSynthesizer();;;
     Transmitter transmitter = midiPlayer.getTransmitter();

     if (synthesizer.getDefaultSoundbank() == null) {//MEANING "IF USING HARDWARE (NOT JRE) SYNTHESIZER"
transmitter.setReceiver(MidiSystem.getReceiver());//THIS IS RIGHT FOR HARDWARE
System.out.println("Hardware synthesizer!");
     else {
transmitter.setReceiver(synthesizer.getReceiver());//SYNTHESIZER.GETRECEIVER() IS RIGHT FOR SOFTWARE

System.out.println("Software synthesizer in use!");

     midiPlayer.setSequence(MidiSystem.getSequence(new File(fileName)));

     ShortMessage volumeMessage = new ShortMessage();
     int numberOfChannels = synthesizer.getChannels().length;
     for (int i = 0; i < numberOfChannels; i++) {
volumeMessage.setMessage(ShortMessage.CONTROL_CHANGE, i, 7, 5); //7 IS MASTER VOLUME CONTROLLER, 5 IS VOLUME BETWEEN 0-127
transmitter.getReceiver().send(volumeMessage, -1);
System.out.println("Is the sequencer an instance of Synthesizer? "+(midiPlayer instanceof Synthesizer));

     MidiDevice device = MidiSystem.getMidiDevice(midiPlayer.getDeviceInfo());
     java.util.List<Transmitter> transmitters = device.getTransmitters();
     Transmitter[] transmitterArray = new Transmitter[transmitters.size()];
     transmitterArray = transmitters.toArray(transmitterArray);

for (int y = 0; y < transmitterArray.length; y++) {
for (int x = 0; x < 16; x++) {
volumeMessage.setMessage(ShortMessage.CONTROL_CHANGE, y, 7, 5); //7 IS MASTER VOLUME CONTROLLER, 5 IS VOLUME BETWEEN 0-127
transmitterArray[y].getReceiver().send(volumeMessage, -1);

     MidiChannel[] channels = synthesizer.getChannels();
     for (int i = 0; i < channels.length; i++){
channels[i].controlChange(7, 5);
System.out.println("Can we lower the volume? "+(channels[i].getController(7)!=0));}

catch (Exception e) {System.out.println("Midi File Error: "+e.getMessage());}

Support / Okino Website Claims 3DS Exports Cameras
« on: January 08, 2009, 04:23:21 pm »
Which, come to think, I'm sure I've seen done. Can we PLEASE get that implemented? It would change my life on 3D/2D hybrids like the game on which I'm currently working.

Support / Ship Lasers After Rotation
« on: November 06, 2008, 05:40:52 pm »
The way the ship flies forward is it's always chasing targetCone. After the following method flips firing to true, the game loop makes the lasers chase after the laserTarget variables using the very same method that always works for the ship. What's weird is that the following code only works before the ship is rotated. Then, for some bizarre reason, the laserTargets start showing up in the wrong place. It's worth mentioning that the laser cylinders are ALWAYS aligned to the ship, but they end up flying sideways after the first rotation.

Code: [Select]
      private void fireLasers() {//SETS IT UP, THEN FLIPS firing TO TRUE SO THAT THE GAME LOOP TAKES IT FROM THERE
laser1 = Primitives.getCylinder(16, 4f, 20f);;
align(laser1, wing1);
// laserTarget1 = Object3D.createDummyObj();
laserTarget1 = Primitives.getBox(10, 1);
align(laserTarget1, targetCone);
moveTowards(laserTarget1, targetCone.getTransformedCenter(), 1f);
laser2 = Primitives.getCylinder(16, 4f, 20f);;
align(laser2, wing2);
// laserTarget2 = Object3D.createDummyObj();
laserTarget2 = Primitives.getBox(10, 1);;
moveTowards(laserTarget2, targetCone.getTransformedCenter(), 1f);

System.out.println("Laser to Ship Distance: "+calculateDistance(xWing, laser1));
firing = true;

Support / Ship Rotation
« on: October 08, 2008, 03:31:01 am »
How do I make it so that a ship is rotated around its own axis? As I understand it, objects are rotated by the world axis, so that the moment I rotate a ship in any of its 3 axis, it's no longer aligned with the worls axis. Or am I far off here?

Support / Why not add a math class?
« on: September 06, 2008, 05:33:30 am »
And include methods like static float calculateAngle(SimpleVector origin, SimpleVector p1, SimpleVector p2)? Until then, if somebody would tell me the code for that I'd be grateful! : -)

Support / Character Moves Towards Mouse Click
« on: August 26, 2008, 09:17:15 pm »
I'm trying to make an RPG with 2D backgrounds and a 3D hero. When the player clicks on the screen, the hero has to move that way. The following's what I did (for translation, rotation is something else). Is it wrong, because it's not working?
Code: [Select]
SimpleVector heroCenter = Interact2D.project3D2D(theCamera, buffer, hero.getTransformedCenter());
SimpleVector destination = Interact2D.reproject2D3D(theCamera, buffer, mousePoint.x-(int)heroCenter.x, mousePoint.y-(int)heroCenter.y, hero.getTransformedCenter().z);
destination.z = destination.y;
destination.y = 0;

Support / What does Animation.getSequenceCount() return?
« on: August 20, 2008, 08:26:49 pm »
Does it return the number of subsequences in the animation, or does it return the number of frames? Because my MD2 file is supposed to have nearly (or exactly) 260 frames and 4 subsequences, and getSequenceCount() returns 16.0. How do I access the number of frames, and then how do I switch between subsequences? For that matter, how do I access the individual frame names?

Support / Any Way to Speed Up an Animation?
« on: August 18, 2008, 09:44:19 am »
There's not much in the Animation class itself, but is there some way of changing the timing of animations I'm missing?

Support / Cyberkilla, In Case You'll Ever Read This
« on: August 07, 2008, 06:13:01 pm »
I found out the location where most of the NullPointerException problems are happening: the method getChild(String) addressed as   
Code: [Select]
XMLElement geometryElement = submesh.getChild("geometry");on private static OGREVertexBuffer loadGeometry(XMLElement) is returning null! Don't know how to fix it yet, but if you don't come back soon I may have to do it myself! : -(

Support / Egon, What About Your Own Skeletal Extension?
« on: August 03, 2008, 04:52:50 pm »
I understand why you didn't have one at first. And maybe don't even include as the main API. But couldn't you build your own skeletal extension, or else study Cyberkilla's and write a loader? Because his OgreXML loader is both limiting and broken. I could send you my models as proff, if you'd be willing to test them. You'll find they load on Max and Maya, but don't on Cyberkilla's API. And a skeletal structure is such a pivotal thing for most games.

Support / Cyberkilla: About Your Skeletal API Again
« on: July 23, 2008, 09:37:41 pm »
Would you be kind enough to get a rigged model from me and send me an OgreXML file that works with your loader? PLEASE? I've tried everything, man. I got a Max 9 exporter, and it doesn't work with complex skeletons. I got a Maya Ogre binary exporter, then used the Ogre tools to get the XML and that didn't work. And I tried optimizing the meshes with OgreCommandLineTools. I used 5 different human models with similarly complex bone structures. All of them crash. PLEASE either convert one for me or send me a human model fully rigged that works with your loader.

By the way, just to clear things up: the exporters all work fine. What always crashes is your loader. And almost always it happens just after all the bones are read and as it's reading the very first mesh.

Or might I suggest a loadOgreXML(Object3D, InputStream, float)? That would help a lot in its own right.

Support / Java 2D Behind JPCT
« on: March 28, 2008, 11:12:44 pm »
Is that possible using the software engine? If so, how, because the 2D graphics always seem to come out on top?

Support / Bow String and Cyberkilla's Skeletal
« on: March 21, 2008, 08:59:39 pm »
I'm making a bow and arrow minigame for which I "modelled" a cylinder with a bone structure on 3dsmax 9 and exported to OgreXML for reading into Cyberkilla's Skeletal API. The cylinder is meant to represent the distorting string of the bow. I tried drawing a 2-D string on the bow, but try as I might I can't get the VertexController to be up-to-date on the bow's coordinates. If I could, that would be an obvious solution. Anyway, in the absence of the 2D string I'm using the boned cylinder. Problem is when I load the string into JPCT it looks completely distorted. If anyone can tell me why I'd appreciate it.

And if someone would kinder stil and make me the scene for exporting I'd be that much the more grateful!

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