Jump to content

  • Log In with Google      Sign In   
  • Create Account

Shadowwoelf

Member Since 22 Jul 2007
Offline Last Active Mar 01 2012 09:29 AM

Topics I've Started

Jogl tutorial

28 February 2012 - 02:05 PM

I need some help finding a good tutorial on JOGL in eclipse. All the ones I found have caused errors, which I couldn't resolve.

Here is what I have done:

I went to the follow wiki and followed the instructions

http://jogamp.org/wiki/index.php/Jogl_Tutorial#JogAmp.27s_Wiki

I downloaded: 32-bit Windows: jogamp-windows-i586.7z
Then in eclipse I extracted all the jars from the jar file. Including everything in the subfolder named Atomic.
With the jar files I made a custom user library. Only thing i didn't do was input each source attachment and native library location.
Then I linked it to my java project

After that I tried running the following code :

package jogl;[/color]
[color="#000000"]import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;[/color]
[color="#000000"]import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLProfile;
import javax.media.opengl.awt.GLCanvas;
import javax.swing.JFrame;[/color]
[color="#000000"]import com.jogamp.graph.curve.opengl.Renderer;[/color]
[color="#000000"]public class HelloWorld {
public static void main(String[] args) {
  // setup OpenGL Version 2
  GLProfile profile = GLProfile.get(GLProfile.GL2);
  GLCapabilities capabilities = new GLCapabilities(profile);[/color]
[color="#000000"]  // The canvas is the widget that's drawn in the JFrame
  GLCanvas glcanvas = new GLCanvas(capabilities);[/color]
[color="#000000"]  // ERROR: Cannont instantion Renderer, addGLEventListener is The method
  // addGLEventListener(GLEventListener) in the type GLCanvas is not
  // applicable for the arguments (Renderer)
  glcanvas.addGLEventListener(new Renderer());[/color]
[color="#000000"]  // END ERROR[/color]
[color="#000000"]  glcanvas.setSize(300, 300);[/color]
[color="#000000"]  JFrame frame = new JFrame("Hello World");
  frame.getContentPane().add(glcanvas);[/color]
[color="#000000"]  // shutdown the program on windows close event
  frame.addWindowListener(new WindowAdapter() {
   public void windowClosing(WindowEvent ev) {
    System.exit(0);
   }
  });[/color]
[color="#000000"]  frame.setSize(frame.getContentPane().getPreferredSize());
  frame.setVisible(true);
}
}

Which gave me an error on the follow "Cannot instantion Renderer, addGLEventListener is The method addGLEventListener(GLEventListener) in the type GLCanvas is not applicable for the arguments (Renderer).

Any help would be appreciated. I feel like once I get this set up, I would be on my way.

Passing world data to AI entites

19 February 2011 - 09:49 PM

I am working on a bug simulation game and was wondering how do I effectively pass world data to the individual bugs.

I have 5 classes. World, Squares, Bug(Abstract), Ant(extended from Bug), Spider (extended from Bug).

World contains an 2d array of squares.

Squares contains an ArrayList of Bugs.

So I am wondering how do I convey the world to the bugs? If I pass by reference then I get into a terrible loop.

Xna networking

02 June 2010 - 06:40 PM

Hi, I was wondering if xna supported pc networking that was independent of xbox live. Also if there was any networking tutorials based on xna.

XNA matrices

10 April 2010 - 05:48 PM

I am having some trouble with matrices. I think its simply the order of operation's that I am using for the matrices.
Matrix thisSprite = 
                Matrix.CreateTranslation(this.Origin.X,-this.Origin.Y,0)*//0,0,0
                Matrix.CreateRotationZ(MathHelper.ToRadians(this.Rotation))*//-30
                Matrix.CreateScale(this.Scale.X, this.Scale.Y, 1) *//1,1,1
                Matrix.CreateTranslation(this.Position.X,this.Position.Y,0);//500,300,0
            Matrix invertSprite = Matrix.Invert(thisSprite);
Vector2 pos1 = new Vector2(mouseX, mouseY);
            Vector2 pos2 = Vector2.Transform(pos1, invertSprite);

If I don't rotate the sprite then the matrix work's fine. So what am I doing wrong with this matrix?

Confused on Pixel perfect detection (Riemers tutorial)

28 March 2010 - 08:29 PM

I was using Riemers tutorials and have been now trying to implement my own pixel perfect detection, but I have run into a problem in the rotation. If I rotate my image X amount of pixels the pixel perfect detection then fails, and I am not sure as to why.
//What the zombies get initialized to.
ZombieList.Add(new Sprite("Game/Zombie"));
                ZombieList[ZombieList.Count - 1].Position.Y = ZombieList[ZombieList.Count - 1].Height;
                ZombieList[ZombieList.Count - 1].Position.X = rnd.Next(0, 800);
                ZombieList[ZombieList.Count - 1].Origin.Y = ZombieList[ZombieList.Count - 1].Height;
                ZombieList[ZombieList.Count - 1].Velocity.Y = (rnd.Next(1, 10) / 100f);
                ZombieList[ZombieList.Count - 1].Rotation = 30;
                ZombieList[ZombieList.Count - 1].Scale = new Vector2(.5f);
                ZombieList[ZombieList.Count - 1].FadeInOut = true;


//I get a point then I use the inverse matrix of the image and 
//then find out where it hits in the texture
//If the .a >0 that means its not transparent and thus there is a hit.
public bool TexturesCollide(float mouseX, float mouseY)
        {
            bool returnValue = false;

            Matrix thisSprite = 
                Matrix.CreateTranslation(this.Origin.X,-this.Origin.Y,0)*
                Matrix.CreateRotationZ(MathHelper.ToRadians(this.Rotation))*
                Matrix.CreateScale(this.Scale.X, this.Scale.Y, 1) *
                Matrix.CreateTranslation(this.Position.X,this.Position.Y,0);
            Matrix invertSprite = Matrix.Invert(thisSprite);

            Vector2 pos1 = new Vector2(mouseX, mouseY);
            Vector2 pos2 = Vector2.Transform(pos1, invertSprite);

            if(pos2.X>0&&pos2.X<this.Texture.Width)
            {
                if(pos2.Y>0&&pos2.Y<this.Texture.Height)
                {
                    if (spriteColorArray[(int)pos2.X, (int)pos2.Y].A > 0)
                    {
                        returnValue = true;                        //This returns when the point is non transparent
                    }
                }
            }

            return returnValue;
        }

Any help would be appreciated! thanks.

PARTNERS