diff options
Diffstat (limited to 'src/demos/misc')
-rwxr-xr-x | src/demos/misc/GLCapsTableDemo.java | 322 | ||||
-rwxr-xr-x | src/demos/misc/Picking.java | 270 | ||||
-rwxr-xr-x | src/demos/misc/TiledRendering.java | 146 | ||||
-rw-r--r-- | src/demos/misc/VersionInfo.java | 58 |
4 files changed, 0 insertions, 796 deletions
diff --git a/src/demos/misc/GLCapsTableDemo.java b/src/demos/misc/GLCapsTableDemo.java deleted file mode 100755 index 766c8a4..0000000 --- a/src/demos/misc/GLCapsTableDemo.java +++ /dev/null @@ -1,322 +0,0 @@ -package demos.misc; - -import java.awt.*; -import java.awt.event.*; -import java.util.*; -import javax.media.opengl.*; -import javax.media.opengl.glu.*; -import javax.swing.*; -import com.sun.opengl.util.FPSAnimator; -import javax.swing.border.TitledBorder; -import javax.swing.table.TableColumn; - -import demos.gears.Gears; - -/******************************************************************************* - * @file GLCapsTableDemo.java - * @desc Demonstrate use of GLCapabilitiesChooser and DefaultGLCapabilities. - * Demo tabulates the available capabilities array and put the data into a - * table. Pressing respawn button displays a canvas created with the - * currently selected index corresponding to the available array. There - * are two canvas to respawn: left or right.<br> - * TODO: if the number of samples > 0, setSampleBuffer(true) and run an - * antialiased renderer?;<br> - * TODO: if pbuffer is available, enable Float, RTT, RTTRec and create a - * pbuffer for eacH?<br> - * TODO: spawn using a diff renderer option(such as ones from demo - * package) <br> - * @version Jan 22, 2006 - GLCapsTableDemo.java created at 7:17:31 PM - * @platform ATI X600SE/XP Tablet SP2/JDK5/Eclipse - * @author Kiet Le - * @legal (c) 2006 Kiet Le. Released under BSD licence. - ******************************************************************************/ -public class GLCapsTableDemo - extends JFrame - implements - GLCapabilitiesChooser -{ - private String[] colNames = - {"Pfd", "H/W", "DblBfr", "Stereo", // index, hwaccel, double, stereo - "CBits", "cR", "cG", "cB", "cA", // color bits - "ABits", "aR", "aG", "aB", "aA", // accum bits - "Z", "S", "AA|AAS", "PBuf(Float|RTT|RTTRec)"}; // depth, stencil, n - // samples, pbuffer - private ArrayList/*<GLCapabilities>*/ available = new ArrayList/*<GLCapabilities>*/(); - private ArrayList/*<Integer>*/ indices = new ArrayList/*<Integer>*/(); - private Object[][] data; - private JTable capsTable; - private int desiredCapIndex; // pfd index - private int selected = desiredCapIndex; - protected JPanel pane, pane2; - private boolean updateLR;// leftright - private DefaultGLCapabilitiesChooser choiceExaminer = // - new DefaultGLCapabilitiesChooser() - { - public int chooseCapabilities(GLCapabilities desired, - GLCapabilities[] available, - int windowSystemRecommendedChoice) - { - if ( available != null ) - for (int i = 0; i < available.length; i++) { - GLCapabilities c = available[i]; - if (c != null) { - GLCapsTableDemo.this.available.add((GLCapabilities) c.clone()); - GLCapsTableDemo.this.indices.add(new Integer(i)); - } - } - desiredCapIndex = super.chooseCapabilities(desired, available, - windowSystemRecommendedChoice); - System.out.println("valid" + desiredCapIndex); - capsTable = GLCapsTableDemo.this - .tabulateTable(GLCapsTableDemo.this.available, GLCapsTableDemo.this.indices); - JScrollPane scroller = // - new JScrollPane(capsTable, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, - JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - GLCapsTableDemo.this.getContentPane().add(scroller); - pane.setBorder(BorderFactory - .createTitledBorder(null, "" + desiredCapIndex, TitledBorder.TRAILING, - TitledBorder.DEFAULT_POSITION)); - pane2.setBorder(BorderFactory - .createTitledBorder(null, "" + desiredCapIndex, TitledBorder.LEADING, - TitledBorder.DEFAULT_POSITION)); - GLCapsTableDemo.this.validate();// so table'll show up - System.out.println("valid"); - return desiredCapIndex; - } - }; - private GraphicsDevice device = GraphicsEnvironment - .getLocalGraphicsEnvironment().getDefaultScreenDevice(); - private JSplitPane canvasPane; - - private GLCanvas canvas; - private GLCanvas canvas2; - private Gears topRenderer = new Gears(), bottomRenderer = new Gears(); - private FPSAnimator animator; - private Dimension defdim = new Dimension(512, 256); - private String visTip = "If no gears are visible, it may be that the " - + "current desktop color resolution doesn't match " - + "the GLCapabilities chosen. Check CBits column."; - - /** - - */ - public GLCapsTableDemo() - { - super(GLCapsTableDemo.class.getName()); - initComponents(); - } - - /** - * (non-Javadoc) - * - * @see javax.media.opengl.GLCapabilitiesChooser#chooseCapabilities(javax.media.opengl.GLCapabilities, - * javax.media.opengl.GLCapabilities[], int) - */ - public int chooseCapabilities(GLCapabilities desired, - GLCapabilities[] available, - int windowSystemRecommendedChoice) - { - int row = capsTable.getSelectedRow(); - int desiredCapIndex = ((Integer) indices.get(row)).intValue(); - if ( updateLR ) - { - pane.setBorder(BorderFactory - .createTitledBorder(null, "" + desiredCapIndex, - TitledBorder.TRAILING, - TitledBorder.DEFAULT_POSITION)); - } - else - { - pane2.setBorder(BorderFactory - .createTitledBorder(null, "" + desiredCapIndex, TitledBorder.LEADING, - TitledBorder.DEFAULT_POSITION)); - } - return desiredCapIndex; - } - - public void run(final String[] args) - { - setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); - setSize(new Dimension((int) (d.width * 0.75), (int) (d.height * 0.75))); - setLocationRelativeTo(null); - setVisible(true); - validate(); - animator.start(); - }// - - /** - * @param args - */ - public static void main(String[] args) - { - GLCapsTableDemo demo = new GLCapsTableDemo(); - demo.run(args); - } - - private void initComponents() - { - pane = new JPanel(); - pane2 = new JPanel(); - // Hack: use multisampled capabilities to pick up more detailed information on Windows - GLCapabilities multisampledCaps = new GLCapabilities(); - multisampledCaps.setSampleBuffers(true); - canvas = new GLCanvas(multisampledCaps, choiceExaminer, null, device); - - // initially start w/ 2 canvas of default caps - // canvas = new GLCanvas(null, choiceExaminer, null, device); - canvas.addGLEventListener(topRenderer); - canvas.setSize(defdim); - // canvas.setPreferredSize(defdim); - // canvas.setMaximumSize(defdim); - animator = new FPSAnimator(canvas, 30); - canvas2 = new GLCanvas(null, null, null, device); - canvas2.addGLEventListener(bottomRenderer); - canvas2.setSize(defdim); - // canvas2.setPreferredSize(defdim); - // canvas2.setMaximumSize(defdim); - animator.add(canvas2); - pane.add(canvas); - pane2.add(canvas2); - canvasPane = new JSplitPane(); - canvasPane.setResizeWeight(0.5);// 50-50 division - canvasPane.setOrientation(JSplitPane.HORIZONTAL_SPLIT); - canvasPane.setLeftComponent(pane); - canvasPane.setRightComponent(pane2); - getContentPane().add(canvasPane, BorderLayout.SOUTH); - getContentPane().add(buildControls(), BorderLayout.NORTH); - } - - private JTable tabulateTable(ArrayList/*<GLCapabilities>*/ capabilities, - ArrayList/*<Integer>*/ indices) - { - capabilities.trimToSize(); - data = new Object[capabilities.size()][colNames.length]; - String t = "T", f = "F"; - for (int pfd = 0; pfd < capabilities.size(); pfd++) - { - data[ pfd ][ 0 ] = indices.get(pfd); - GLCapabilities cap = (GLCapabilities) capabilities.get(pfd); - data[ pfd ][ 1 ] = "" + (cap.getHardwareAccelerated() ? f : f); - data[ pfd ][ 2 ] = "" + (cap.getDoubleBuffered() ? t : f); - data[ pfd ][ 3 ] = "" + (cap.getStereo() ? t : f); - int r = cap.getRedBits(), // - g = cap.getGreenBits(), // - b = cap.getBlueBits(), // - a = cap.getAlphaBits(); - data[ pfd ][ 4 ] = "" + (r + g + b + a); - data[ pfd ][ 5 ] = new Integer(r); - data[ pfd ][ 6 ] = new Integer(g); - data[ pfd ][ 7 ] = new Integer(b); - data[ pfd ][ 8 ] = new Integer(a); - r = cap.getAccumRedBits(); - g = cap.getAccumGreenBits(); - b = cap.getAccumBlueBits(); - a = cap.getAccumAlphaBits(); - data[ pfd ][ 9 ] = "" + (r + g + b + a); - data[ pfd ][ 10 ] = new Integer(r); - data[ pfd ][ 11 ] = new Integer(g); - data[ pfd ][ 12 ] = new Integer(b); - data[ pfd ][ 13 ] = new Integer(a); - // - data[ pfd ][ 14 ] = "" + cap.getDepthBits(); - data[ pfd ][ 15 ] = "" + cap.getStencilBits(); - data[ pfd ][ 16 ] = "" + (cap.getSampleBuffers() ? t : f) + " | " - + cap.getNumSamples(); - // concat p buffer nfo - String pbuf = (cap.getPbufferFloatingPointBuffers() ? "T |" : "F |"); - pbuf += (cap.getPbufferRenderToTexture() ? "T | " : "F | "); - pbuf += (cap.getPbufferRenderToTextureRectangle() ? t : f); - data[ pfd ][ 17 ] = pbuf; - } - JTable table = new JTable(data, colNames) { - public boolean isCellEditable(int rowIndex, int colIndex) { - return false; - } - }; - // table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - table.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); - TableColumn column = null; - for (int i = 0; i < colNames.length; i++) - { - column = table.getColumnModel().getColumn(i); - if ( i == (colNames.length - 1) ) - { - column.setPreferredWidth(100); // pbuffer column is bigger - } - else column.setPreferredWidth(7); - } - table.setDoubleBuffered(true); - return table; - } - - private JPanel buildControls() - { - JPanel controls = new JPanel(); - final JButton spawn = new JButton("Respawn Left"); - final JButton spawn2 = new JButton("Respawn Right"); - ActionListener recap = new ActionListener() - { - public void actionPerformed(final ActionEvent act) - { - animator.stop(); - if ( act.getSource() == spawn ) - { - updateLR = true;// left - animator.remove(canvas); - pane.remove(canvas); - canvas = newCanvas(true, true);// get new canvas w/ selected index - pane.add(canvas); - animator.add(canvas); - } - else - { - updateLR = false; - animator.remove(canvas2); - pane2.remove(canvas2); - canvas2 = newCanvas(true, false); - pane2.add(canvas2); - animator.add(canvas2); - } - new Thread() - { - public void run() - { - animator.start(); - } - }.start(); - GLCapsTableDemo.this.validate(); - } - }; - spawn.setToolTipText(visTip); - spawn.addActionListener(recap); - spawn2.addActionListener(recap); - // - controls.add(spawn); - controls.add(spawn2); - return controls; - } - - private GLCanvas newCanvas(boolean mycap, boolean top) - { - GLCanvas surface = null; - if ( !mycap ) surface = new GLCanvas(null, choiceExaminer, null, device); - else surface = new GLCanvas(null, this, null, device); - if ( top ) surface.addGLEventListener(topRenderer); - else surface.addGLEventListener(bottomRenderer); - surface.setSize(defdim);// otherwise, no show; mixin' light-heavy containers - // surface.setMinimumSize(defdim); - return surface; - } - - private void exitRunner() - { - new Thread() - { - public void run() - { - animator.stop(); - } - }; - } -}// diff --git a/src/demos/misc/Picking.java b/src/demos/misc/Picking.java deleted file mode 100755 index 2fe8b2d..0000000 --- a/src/demos/misc/Picking.java +++ /dev/null @@ -1,270 +0,0 @@ -package demos.misc; - -//================================================================================= -// Picking 0.2 (Thomas Bladh) -//================================================================================= -// A simple picking example using java/jogl. This is far from a complete solution -// but it should give you an idea of how to include picking in your assigment -// solutions. -// -// Notes: * Based on example 13-3 (p 542) in the "OpenGL Programming Guide" -// * This version should handle overlapping objects correctly. -//--------------------------------------------------------------------------------- -import java.awt.*; -import java.awt.event.*; -import java.awt.Canvas.*; -import java.nio.*; -import java.util.*; -import javax.media.opengl.*; -import javax.media.opengl.glu.*; -import com.sun.opengl.util.*; - -public class Picking -{ - public static void main(String[] args) - { - new Picking(); - } - - Picking() - { - Frame frame = new Frame("Picking Example"); - GLDrawableFactory factory = GLDrawableFactory.getFactory(); - GLCapabilities capabilities = new GLCapabilities(); - GLCanvas drawable = new GLCanvas(capabilities); - drawable.addGLEventListener(new Renderer()); - frame.add(drawable); - frame.setSize(400, 400); - final Animator animator = new Animator(drawable); - frame.addWindowListener(new WindowAdapter() - { - public void windowClosing(WindowEvent e) - { - animator.stop(); - System.exit(0); - } - }); - frame.show(); - animator.start(); - } - - static class Renderer implements GLEventListener, MouseListener, MouseMotionListener - { - static final int NOTHING = 0, UPDATE = 1, SELECT = 2; - int cmd = UPDATE; - int mouse_x, mouse_y; - - private GLU glu = new GLU(); - private GLAutoDrawable gldrawable; - - public void init(GLAutoDrawable drawable) - { - GL gl = drawable.getGL(); - this.gldrawable = drawable; - gl.glEnable(GL.GL_CULL_FACE); - gl.glEnable(GL.GL_DEPTH_TEST); - gl.glEnable(GL.GL_NORMALIZE); - gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); - drawable.addMouseListener(this); - drawable.addMouseMotionListener(this); - } - - public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) - { - GL gl = drawable.getGL(); - float h = (float) height / (float) width; - gl.glViewport(0, 0, width, height); - gl.glMatrixMode(GL.GL_PROJECTION); - gl.glLoadIdentity(); - glu.gluOrtho2D(0.0f,1.0f,0.0f,1.0f); - } - - public void display(GLAutoDrawable drawable) - { - GL gl = drawable.getGL(); - switch(cmd) - { - case UPDATE: - drawScene(gl); - break; - case SELECT: - int buffsize = 512; - double x = (double) mouse_x, y = (double) mouse_y; - int[] viewPort = new int[4]; - IntBuffer selectBuffer = BufferUtil.newIntBuffer(buffsize); - int hits = 0; - gl.glGetIntegerv(GL.GL_VIEWPORT, viewPort, 0); - gl.glSelectBuffer(buffsize, selectBuffer); - gl.glRenderMode(GL.GL_SELECT); - gl.glInitNames(); - gl.glMatrixMode(GL.GL_PROJECTION); - gl.glPushMatrix(); - gl.glLoadIdentity(); - glu.gluPickMatrix(x, (double) viewPort[3] - y, 5.0d, 5.0d, viewPort, 0); - glu.gluOrtho2D(0.0d, 1.0d, 0.0d, 1.0d); - drawScene(gl); - gl.glMatrixMode(GL.GL_PROJECTION); - gl.glPopMatrix(); - gl.glFlush(); - hits = gl.glRenderMode(GL.GL_RENDER); - processHits(hits, selectBuffer); - cmd = UPDATE; - break; - } - } - - public void processHits(int hits, IntBuffer buffer) - { - System.out.println("---------------------------------"); - System.out.println(" HITS: " + hits); - int offset = 0; - int names; - float z1, z2; - for (int i=0;i<hits;i++) - { - System.out.println("- - - - - - - - - - - -"); - System.out.println(" hit: " + (i + 1)); - names = buffer.get(offset); offset++; - z1 = (float) buffer.get(offset) / 0x7fffffff; offset++; - z2 = (float) buffer.get(offset) / 0x7fffffff; offset++; - System.out.println(" number of names: " + names); - System.out.println(" z1: " + z1); - System.out.println(" z2: " + z2); - System.out.println(" names: "); - - for (int j=0;j<names;j++) - { - System.out.print(" " + buffer.get(offset)); - if (j==(names-1)) - System.out.println("<-"); - else - System.out.println(); - offset++; - } - System.out.println("- - - - - - - - - - - -"); - } - System.out.println("---------------------------------"); - } - - public int viewPortWidth(GL gl) - { - int[] viewPort = new int[4]; - gl.glGetIntegerv(GL.GL_VIEWPORT, viewPort, 0); - return viewPort[2]; - } - - public int viewPortHeight(GL gl) - { - int[] viewPort = new int[4]; - gl.glGetIntegerv(GL.GL_VIEWPORT, viewPort, 0); - return viewPort[3]; - } - - public void drawScene(GL gl) - { - gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); - - // Colors - float red[] = {1.0f,0.0f,0.0f,1.0f}; - float green[] = {0.0f,1.0f,0.0f,1.0f}; - float blue[] = {0.0f,0.0f,1.0f,1.0f}; - - // Red rectangle - GLRectangleEntity r1 = new GLRectangleEntity(gl, glu); - r1.x = 0.15f; - r1.y = 0.25f; - r1.z = 0.75f; - r1.w = 0.4f; - r1.h = 0.4f; - r1.c = red; - r1.id = 10; - r1.draw(); - - // Green rectangle - GLRectangleEntity r2 = new GLRectangleEntity(gl, glu); - r2.x = 0.35f; - r2.y = 0.45f; - r2.z = 0.5f; - r2.w = 0.4f; - r2.h = 0.4f; - r2.c = green; - r2.id = 20; - r2.draw(); - - // Blue rectangle - GLRectangleEntity r3 = new GLRectangleEntity(gl, glu); - r3.x = 0.45f; - r3.y = 0.15f; - r3.z = 0.25f; - r3.w = 0.4f; - r3.h = 0.4f; - r3.c = blue; - r3.id = 30; - r3.draw(); - - gl.glFlush(); - } - - public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) {} - - public void mousePressed(MouseEvent e) - { - cmd = SELECT; - mouse_x = e.getX(); - mouse_y = e.getY(); - } - - public void mouseEntered(MouseEvent e) {} - public void mouseExited(MouseEvent e) {} - public void mouseReleased(MouseEvent e) {} - public void mouseClicked(MouseEvent e) {} - public void mouseDragged(MouseEvent e) {} - public void mouseMoved(MouseEvent e) {} - - public abstract class GLEntity - { - float x, y, z; - float[] c; - int id = 0; - boolean outline = false; - GL gl; - GLU glu; - public GLEntity(GL gl, GLU glu) - { - this.gl = gl; - this.glu = glu; - } - public void draw() - { - gl.glPushName(id); - _draw(); - } - public abstract void _draw(); - } - - public class GLRectangleEntity extends GLEntity - { - float w = 0.1f; - float h = 0.1f; - public GLRectangleEntity(GL gl, GLU glu) - { - super(gl, glu); - } - public void _draw() - { - if (outline) - gl.glPolygonMode(GL.GL_FRONT, GL.GL_LINE); - else - gl.glPolygonMode(GL.GL_FRONT, GL.GL_FILL); - - gl.glColor4fv(c, 0); - gl.glBegin(GL.GL_POLYGON); - gl.glVertex3f(x, y, z); - gl.glVertex3f(x + w, y, z); - gl.glVertex3f(x + w, y + h, z); - gl.glVertex3f(x, y + h, z); - gl.glEnd(); - } - } - } -} diff --git a/src/demos/misc/TiledRendering.java b/src/demos/misc/TiledRendering.java deleted file mode 100755 index f5b857e..0000000 --- a/src/demos/misc/TiledRendering.java +++ /dev/null @@ -1,146 +0,0 @@ -package demos.misc; - -import java.awt.image.*; -import java.io.*; -import java.nio.*; -import javax.imageio.*; - -import javax.media.opengl.*; -import com.sun.opengl.util.*; - -import demos.gears.Gears; - -/** Demonstrates the TileRenderer class by rendering a large version - of the Gears demo to the specified file. */ - -public class TiledRendering { - public static void main(String[] args) throws IOException { - if (args.length != 1) { - System.out.println("Usage: java TiledRendering [output file name]"); - System.out.println("Writes output (a large version of the Gears demo) to"); - System.out.println("the specified file, using either ImageIO or the fast TGA writer"); - System.out.println("depending on the file extension."); - System.exit(1); - } - - String filename = args[0]; - File file = new File(filename); - - if (!GLDrawableFactory.getFactory().canCreateGLPbuffer()) { - System.out.println("Demo requires pbuffer support"); - System.exit(1); - } - - // Use a pbuffer for rendering - GLCapabilities caps = new GLCapabilities(); - caps.setDoubleBuffered(false); - GLPbuffer pbuffer = GLDrawableFactory.getFactory().createGLPbuffer(caps, null, - 256, 256, - null); - - // Fix the image size for now - int tileWidth = 256; - int tileHeight = 256; - int imageWidth = tileWidth * 16; - int imageHeight = tileHeight * 12; - - // Figure out the file format - TGAWriter tga = null; - BufferedImage img = null; - Buffer buf = null; - - if (filename.endsWith(".tga")) { - tga = new TGAWriter(); - tga.open(file, - imageWidth, - imageHeight, - false); - buf = tga.getImageData(); - } else { - img = new BufferedImage(imageWidth, imageHeight, BufferedImage.TYPE_3BYTE_BGR); - buf = ByteBuffer.wrap(((DataBufferByte) img.getRaster().getDataBuffer()).getData()); - } - - // Initialize the tile rendering library - TileRenderer renderer = new TileRenderer(); - renderer.setTileSize(tileWidth, tileHeight, 0); - renderer.setImageSize(imageWidth, imageHeight); - renderer.setImageBuffer(GL.GL_BGR, GL.GL_UNSIGNED_BYTE, buf); - renderer.trPerspective(20.0f, (float) imageWidth / (float) imageHeight, 5.0f, 60.0f); - - GLContext context = pbuffer.getContext(); - if (context.makeCurrent() == GLContext.CONTEXT_NOT_CURRENT) { - System.out.println("Error making pbuffer's context current"); - System.exit(1); - } - - GL gl = pbuffer.getGL(); - gl.glMatrixMode(GL.GL_MODELVIEW); - gl.glLoadIdentity(); - gl.glTranslatef(0.0f, 0.0f, -40.0f); - // Tile renderer will set up projection matrix - - do { - renderer.beginTile(gl); - drawGears(gl); - } while (renderer.endTile(gl)); - - context.release(); - - // Close things up and/or write image using ImageIO - if (tga != null) { - tga.close(); - } else { - ImageUtil.flipImageVertically(img); - if (!ImageIO.write(img, FileUtil.getFileSuffix(file), file)) { - System.err.println("Error writing file using ImageIO (unsupported file format?)"); - } - } - } - - private static void drawGears(GL gl) { - float view_rotx = 20.0f, view_roty = 30.0f, view_rotz = 0.0f; - float angle = 0.0f; - float pos[] = { 5.0f, 5.0f, 10.0f, 0.0f }; - float red[] = { 0.8f, 0.1f, 0.0f, 1.0f }; - float green[] = { 0.0f, 0.8f, 0.2f, 1.0f }; - float blue[] = { 0.2f, 0.2f, 1.0f, 1.0f }; - - gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); - - gl.glLightfv(GL.GL_LIGHT0, GL.GL_POSITION, pos, 0); - gl.glEnable(GL.GL_CULL_FACE); - gl.glEnable(GL.GL_LIGHTING); - gl.glEnable(GL.GL_LIGHT0); - gl.glEnable(GL.GL_DEPTH_TEST); - gl.glEnable(GL.GL_NORMALIZE); - - gl.glPushMatrix(); - gl.glRotatef(view_rotx, 1.0f, 0.0f, 0.0f); - gl.glRotatef(view_roty, 0.0f, 1.0f, 0.0f); - gl.glRotatef(view_rotz, 0.0f, 0.0f, 1.0f); - - gl.glPushMatrix(); - gl.glTranslatef(-3.0f, -2.0f, 0.0f); - gl.glRotatef(angle, 0.0f, 0.0f, 1.0f); - gl.glMaterialfv(GL.GL_FRONT, GL.GL_AMBIENT_AND_DIFFUSE, red, 0); - Gears.gear(gl, 1.0f, 4.0f, 1.0f, 20, 0.7f); - gl.glPopMatrix(); - - gl.glPushMatrix(); - gl.glTranslatef(3.1f, -2.0f, 0.0f); - gl.glRotatef(-2.0f * angle - 9.0f, 0.0f, 0.0f, 1.0f); - gl.glMaterialfv(GL.GL_FRONT, GL.GL_AMBIENT_AND_DIFFUSE, green, 0); - Gears.gear(gl, 0.5f, 2.0f, 2.0f, 10, 0.7f); - gl.glPopMatrix(); - - gl.glPushMatrix(); - gl.glTranslatef(-3.1f, 4.2f, 0.0f); - gl.glRotatef(-2.0f * angle - 25.0f, 0.0f, 0.0f, 1.0f); - gl.glMaterialfv(GL.GL_FRONT, GL.GL_AMBIENT_AND_DIFFUSE, blue, 0); - Gears.gear(gl, 1.3f, 2.0f, 0.5f, 10, 0.7f); - gl.glPopMatrix(); - - gl.glPopMatrix(); - } -} diff --git a/src/demos/misc/VersionInfo.java b/src/demos/misc/VersionInfo.java deleted file mode 100644 index 589d899..0000000 --- a/src/demos/misc/VersionInfo.java +++ /dev/null @@ -1,58 +0,0 @@ - -package demos.misc; - -/** - * VersionInfo.java <BR> - * author: Travis Bryson <P> - * - * This program returns the version and implementation information for the Java - * Bindings for OpenGL (R) implementation found in the CLASSPATH. This information - * is also found in the manifest for jogl.jar, and this program uses the - * java.lang.Package class to retrieve it programatically. -**/ - -public class VersionInfo { - public VersionInfo() { - ClassLoader classLoader = getClass().getClassLoader(); - pkgInfo(classLoader, "javax.media.opengl", "GL"); - } - - static void pkgInfo(ClassLoader classLoader, - String pkgName, - String className) { - - try { - classLoader.loadClass(pkgName + "." + className); - - Package p = Package.getPackage(pkgName); - if (p == null) { - System.out.println("WARNING: Package.getPackage(" + - pkgName + - ") is null"); - } - else { - System.out.println(p); - System.out.println("Specification Title = " + - p.getSpecificationTitle()); - System.out.println("Specification Vendor = " + - p.getSpecificationVendor()); - System.out.println("Specification Version = " + - p.getSpecificationVersion()); - - System.out.println("Implementation Vendor = " + - p.getImplementationVendor()); - System.out.println("Implementation Version = " + - p.getImplementationVersion()); - } - } - catch (ClassNotFoundException e) { - System.out.println("Unable to load " + pkgName); - } - - System.out.println(); - } - - public static void main(String[] args) { - new VersionInfo(); - } -} |