Ok well here is an odd update, i seem to have gotton JOGL installed, and when i run the program below it works, but when i kept following down the site for some more samples, it could never find the method createGLCanvas (something like that if not exact) which confuses me as a lot of sites use that in their program, why isnt it working? Do i need to download something else to get the whole canvas thing working?
Code that works (i had to change the import from import net.java somethin games and so on.
import javax.media.opengl.*;
public class HelloWorld {
public static void main (String args[]) {
try {
System.loadLibrary("jogl");
System.out.println("Hello World! (The native libraries are installed.)");
GLCapabilities caps = new GLCapabilities();
System.out.println("Hello JOGL! (The jar appears to be available.)");
} catch (Exception e) {
System.out.println(e);
}
}
CODE THAT DOESNT WORK
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import net.java.games.jogl.*;
/**
* This is a basic JOGL app. Feel free to
* reuse this code or modify it.
*/
public class SimpleJoglApp extends JFrame {
public static void main(String[] args) {
final SimpleJoglApp app = new SimpleJoglApp();
// show what we've done
SwingUtilities.invokeLater (
new Runnable() {
public void run() {
app.setVisible(true);
}
}
);
}
public SimpleJoglApp() {
//set the JFrame title
super("Simple JOGL Application");
//kill the process when the JFrame is closed
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//only three JOGL lines of code ... and here they are
GLCapabilities glcaps = new GLCapabilities();
GLCanvas glcanvas = GLDrawableFactory.getFactory().createGLCanvas(glcaps);
glcanvas.addGLEventListener(new SimpleGLEventListener());
//add the GLCanvas just like we would any Component
getContentPane().add(glcanvas, BorderLayout.CENTER);
setSize(500, 300);
//center the JFrame on the screen
centerWindow(this);
}
public void centerWindow(Component frame) {
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Dimension frameSize = frame.getSize();
if (frameSize.width > screenSize.width ) frameSize.width = screenSize.width;
if (frameSize.height > screenSize.height) frameSize.height = screenSize.height;
frame.setLocation (
(screenSize.width - frameSize.width ) >> 1,
(screenSize.height - frameSize.height) >> 1
);
}
}
[Edited by - Swattkidd on March 25, 2007 2:47:15 PM]