Show Posts
|
|
Pages: [1]
|
|
5
|
Java Game APIs & Engines / Java Sound & OpenAL / Streaming problem on WinXP
|
on: 2004-01-19 17:58:00
|
|
Dear All,
I am using the latest Joal code from CVS and the latest OpenAL SDK (not the one on their CVS server).
I am streaming buffers to Joal using a variant of Tutorial 8 on DevNet (from which JoAL tutorials are based).
I noticed that JoAL/OpenAL got preempted quite easily, as the author noted. However, when Windows Media Player is started with some sound and then paused, there is no pre-emption anymore. I believe this indicates a bug in the initialization of JoAL/OpenAL.
To initialize JoAL/OpenAL, I simply use ALut.alutInit(); which initializes DirectSound. I tried with DirectSound3D by expanding alutInit() but anyway, the problem remains.
Does anyone knows a better to initialize OpenAL? or a fix for this issue?
Thanks,
Mike
|
|
|
|
|
7
|
Java Game APIs & Engines / Java Sound & OpenAL / Re: Joal tutorial crashes
|
on: 2004-01-13 17:32:12
|
|
That might help: when I trace the issue on a DOS box, the DLL creates the device in openNativeDevice(), the java object it returns has address: a0c384. When DLL's createNativeContext() is called, in the DOS box, the device address is different. On Eclipse IDE, the address is the same.
So strangely enough: when createNativeContext() is given the same Java device object address, it crashes. When the address is different, it works.
Mike
|
|
|
|
|
8
|
Java Game APIs & Engines / Java Sound & OpenAL / Re: Joal tutorial crashes
|
on: 2004-01-13 16:48:58
|
|
Dear All,
I downloaded the tutorials and JoAL yesterday (and the latest OpenAL SDK), recompiled everything, pass the tests (in the SDK and JoAL) but the tutorial are crashing and I have the same error output as listed in previous emails.
But what is odd is that if I run the samples from a DOS box, then they work. If I run them from an IDE, then they crash. I am on WinXP, I don't use EAX, use Eclipse IDE.
I tried to trace the issue. The problem seems to be in Java_net_java_games_joal_ALCImpl_createContextNative when it calls alcCreateContext(). That's where the JVM crashes.
In lesson 1, on a DOS box, it crashes when I quit in ALut.aluExit() because in the first call, alc is null! Weird indeed as all other lessons work fine but only from a DOS box.
Thanks for your help,
Mike
|
|
|
|
|
9
|
Java Game APIs & Engines / JOGL Development / Picking problem?
|
on: 2003-08-15 21:34:59
|
Dear All, While debugging some picking code, I decided to try the picksquare sample in OpenGL red book. The code doesn't work and I'm not sure why, can anyone help?  Thanks, Here is the sample ported to JOGL: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171
| import java.awt.Frame; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent;
import net.java.games.jogl.Animator; import net.java.games.jogl.GL; import net.java.games.jogl.GLCanvas; import net.java.games.jogl.GLCapabilities; import net.java.games.jogl.GLDrawable; import net.java.games.jogl.GLDrawableFactory; import net.java.games.jogl.GLEventListener; import net.java.games.jogl.GLU;
public class PickSquare { public static void main(String[] args) { Frame frame = new Frame("PickSquare Demo"); GLCanvas canvas = GLDrawableFactory.getFactory().createGLCanvas(new GLCapabilities());
canvas.addGLEventListener(new PickSquareSample()); frame.add(canvas); frame.setSize(300, 300); final Animator animator = new Animator(canvas); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { animator.stop(); System.exit(0); } }); frame.show(); animator.start(); } static class PickSquareSample implements GLEventListener, MouseListener { GL myGL; GLU myGLU; private int board[][] = new int[3][3]; private void init () { int i, j; for (i = 0; i < 3; i++) { for (j = 0; j < 3; j++) { board [i][j] = 0; } } myGL.glClearColor (0.0f, 0.0f, 0.0f, 0.0f); } private void drawSquares (int mode) { int i, j; for (i = 0; i < 3; i++) { if (mode == GL.GL_SELECT) { myGL.glLoadName (i); } for (j = 0; j < 3; j ++) { if (mode == GL.GL_SELECT) { myGL.glPushName (j); } myGL.glColor3f ((float)(i/3.0),(float)(j/3.0),(float)(board[i][j]/3.0)); myGL.glRecti (i, j, i+1, j+1); if (mode == GL.GL_SELECT) { myGL.glPopName (); } } } } private void processHits (int hits, int buffer []) { int i, j; int ii = 0, jj = 0, names, ptr; System.out.println ("hits = " + hits); ptr = 0; for (i = 0; i < hits; i++) { names = buffer [ptr]; System.out.println (" number of names for hit = " + names); ptr++; System.out.print (" z1 is " + buffer [ptr] + ";"); ptr++; System.out.println (" z2 is " + buffer [ptr]); ptr++; System.out.print (" the name is "); for (j = 0; j < names; j++) { System.out.print (buffer [ptr] + " "); if (j == 0) { ii = buffer [ptr]; } else { jj = buffer [ptr]; } ptr++; } System.out.println (); board [ii][jj] = (board [ii][jj] + 1) % 3; } } private static final int BUFSIZE = 512; private void pickSquares (MouseEvent e) { int selectBuf [] = new int [BUFSIZE]; int hits; int viewport [] = new int [4]; int x, y; x = e.getX (); y = e.getY (); myGL.glGetIntegerv (GL.GL_VIEWPORT, viewport); myGL.glSelectBuffer (BUFSIZE, selectBuf); myGL.glRenderMode (GL.GL_SELECT); myGL.glInitNames (); myGL.glPushName (-1); myGL.glMatrixMode (GL.GL_PROJECTION); myGL.glPushMatrix (); myGL.glLoadIdentity (); myGLU.gluPickMatrix((double)x,(double)(viewport[3]-y),5.0,5.0,viewport); myGLU.gluOrtho2D (0.0, 3.0, 0.0, 3.0); drawSquares (GL.GL_SELECT); myGL.glPopMatrix (); myGL.glFlush (); hits = myGL.glRenderMode (GL.GL_RENDER); processHits (hits, selectBuf); } public void mousePressed(MouseEvent e) { if ((e.getModifiers() & MouseEvent.BUTTON1_MASK) == MouseEvent.BUTTON1_MASK) { pickSquares (e); e.consume (); } } public void display (GLDrawable d) { myGL.glClear (GL.GL_COLOR_BUFFER_BIT); drawSquares (GL.GL_RENDER); myGL.glFlush (); } public void reshape(GLDrawable drawable, int x, int y, int w, int h) { myGL.glViewport (0, 0, w, h); myGL.glMatrixMode (GL.GL_PROJECTION); myGL.glLoadIdentity (); myGLU.gluOrtho2D (0.0, 3.0, 0.0, 3.0); myGL.glMatrixMode (GL.GL_MODELVIEW); myGL.glLoadIdentity (); } public void init (GLDrawable drawable) { myGL=drawable.getGL(); myGLU=drawable.getGLU(); drawable.addMouseListener(this); init (); }
public void displayChanged(GLDrawable arg0, boolean arg1, boolean arg2) {} public void mouseClicked(MouseEvent e) {} public void mouseEntered(MouseEvent arg0) {} public void mouseExited(MouseEvent arg0) {} public void mouseReleased(MouseEvent arg0) {} } } |
|
|
|
|
|
|
Add your game by posting it in the WIP section,
or publish it in Showcase.
The first screenshot will be displayed as a thumbnail.
|
|