Show Posts
|
Pages: [1]
|
1
|
Java Game APIs & Engines / JOGL Development / Crash with glMultiDrawElements() and vertex arrays
|
on: 2007-08-24 12:08:59
|
Hello, I am having a similar case with a JVM crash, but when using glMultiDrawElements() and vertex arrays. I checked all the things that Keith mentioned above and all seem to be done right. It is very strange, because the crash occurs on 2 Windows machines and doesn't occur on the Linux-Mashine. I don't know if it is some kind of bug, or if my code is incorrect. The method that is producing the error is here: 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
| public void renderPrimitives(GL gl) { gl.glMatrixMode(GL.GL_MODELVIEW); gl.glPushMatrix();
gl.glMultMatrixf(viewMatrix, 0);
gl.glEnable(GL.GL_CULL_FACE); gl.glCullFace(GL.GL_BACK);
gl.glEnableClientState(GL.GL_VERTEX_ARRAY);
float[] varray = new float[vertices.length * 3]; int k = 0; for (Vector3DVO v : vertices) { varray[k++] = v.x; varray[k++] = v.z; varray[k++] = -v.y; } FloatBuffer verticesBuffer = BufferUtil.newFloatBuffer(vertices.length * 3); verticesBuffer.put(varray); verticesBuffer.rewind(); gl.glVertexPointer(3, GL.GL_FLOAT, 0, verticesBuffer);
int[] counts = new int[faces_vertices.length]; IntBuffer[] indices = new IntBuffer[faces_vertices.length]; for (int i = 0; i < faces_vertices.length; i++) { counts[i] = faces_vertices[i].length; indices[i] = BufferUtil.newIntBuffer(faces_vertices[i].length); indices[i].put(faces_vertices[i]); indices[i].rewind(); } gl.glMultiDrawElements(GL.GL_POLYGON, counts, 0, GL.GL_UNSIGNED_INT, indices, faces_vertices.length);
gl.glDisableClientState(GL.GL_VERTEX_ARRAY);
gl.glPopMatrix(); } |
On the Ubuntu Machine (JDK 1.6, ATI Radeon X1600 with the ATI driver xorg-driver-fglrx 7.1.0-8.34) it runs normally. On the first Windows Machine (JDK 1.6, ATI Radeon 9600 with the latest drivers 8.401.0.0) it crashes with this message: 1 2 3 4 5
| # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x6936eae5, pid=1460, tid=444 # # Java VM: Java HotSpot(TM) Client VM (1.6.0_02-b06 mixed mode, sharing) # Problematic frame: # C [atioglxx.dll+0x36eae5] |
On the second Windows Machine (JDK 1.6 or JDK 1.5, NVIDIA GeForce 6200SE TurboCache with 6.14.10.9371 drivers) it also crashes with a similar message: 1 2 3 4 5 6 7
| # An unexpected error has been detected by Java Runtime Environment: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x695e320a, pid=3708, tid=2388 # # Java VM: Java HotSpot(TM) Client VM (1.6.0_01-b06 mixed mode, sharing) # Problematic frame: # C [nvoglnt.dll+0xe320a] |
I also noticed, that this is somehow related with intensive IO - it crashes at the start of the application, when a lot of files are being read from the disk (in another thread). When I suspend the rendering thread with a Breakpoint for some seconds, until no more files are being read, the application doesn't crash. Does anybody have a clue of what is going on? Best Regards, Ivan
|
|
|
2
|
Java Game APIs & Engines / JOGL Development / Using Overlay to draw a Swing GUI over a GLCanvas
|
on: 2007-08-23 13:37:56
|
Greetings everybody We are developing a 3D game with JOGL with its user interface made completely in Swing [1]. The widgets are also made translucent by the look-and-feel. The 3D scene is placed in a GLJPanel and the GUI widgets are placed in a JLayeredPane on top of the scene, like a HUD. Unfortunately the game is running very very slow - just about 10 fps [2]. Now we want to use the GLCanvas for the 3D scene and because GLCanvas is heavyweight, we want use the Overlay class for drawing the Swing components on it. Is there a best-practice on how the overlay class is used? Currently it works, but it doesn't display translucent widgets correctly - the content of some widgets is drawn multiple times in the other widgets. I suppose the problem lies in the custom RepaintManager that we use. I would be very thankful for any tips on using the Overlay class in general, or in conjunction with translucent components. Below I have included some parts of the code. The important classes are SceneCanvas (a GLCanvas and GLEventListener), a HUDPane (the JLayeredPane with the Swing Components), and a HUDRepaintManager. We have overriden the paint(Graphics g) method of the HUDPane and call it with a Graphics object created from the Overlay. In the HUDRepaintManager we are tracking the dirty region that must be re-drawn (with markDirty()) on the Overlay. [1]: I have read that it is better to use pure OpenGL like FengGUI does, but the GUI is already implemented and it would be very hard to port it. Furthermore we use a very customized look and feel and I don't know if FengGUI supports that. [2]: We tried with the OpenGL pipeline, but it worked correctly only on a few machines, on the rest the game and some demo apps with the pipeline enabled were not displaying correctly. 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
| class SceneCanvas extends GLCanvas implements GLEventListener {
public void init(GLAutoDrawable gld) { ... }
public void display(GLAutoDrawable gld) { ...
Graphics2D g2d = (Graphics2D) overlay.createGraphics(); if (overlay.contentsLost()) { g2d.setBackground(TRANSPARENT_BLACK); g2d.clearRect(0, 0, getWidth(), getHeight());
Rectangle dirty = hudRepaintManager.getAndResetDirtyRegion(); g2d.setClip(dirty); hudPane.paint(g2d); overlay.markDirty(dirty.x, dirty.y, dirty.width, dirty.height); }
g2d.dispose();
GLTextureManager.reset(gl); gl.glColor4f(1, 1, 1, 1);
overlay.drawAll(); } }
class HUDPane extends JLayeredPane { public void paint(Graphics g) { if (GLContext.getCurrent() != null) { super.paint(g); } } }
class HUDRepaintManager extends RepaintManager { private boolean hasDirtyRegion = false; private int dirtyMinX = Integer.MAX_VALUE; private int dirtyMaxX = Integer.MIN_VALUE; private int dirtyMinY = Integer.MAX_VALUE; private int dirtyMaxY = Integer.MIN_VALUE;
private HUDPane hudPane;
public HUDRepaintManager(HUDPane hudPane) { super(); this.hudPane = hudPane; }
public Rectangle getAndResetDirtyRegion() { Rectangle dirty = hasDirtyRegion ? getDirtyRectangle() : null;
dirtyMinX = Integer.MAX_VALUE; dirtyMaxX = Integer.MIN_VALUE; dirtyMinY = Integer.MAX_VALUE; dirtyMaxY = Integer.MIN_VALUE; hasDirtyRegion = false;
return dirty; }
public boolean hasDirtyRegion() { return hasDirtyRegion; }
@Override public void addDirtyRegion(JComponent c, int x, int y, int w, int h) { super.addDirtyRegion(c, x, y, w, h);
if (!isPartOfComponentTree(c, hudPane)) return;
Rectangle rect = SwingUtilities.convertRectangle( c, new Rectangle(x, y, w, h), hudPane); x = rect.x; y = rect.y; w = rect.width; h = rect.height;
if (x < dirtyMinX) { dirtyMinX = x; hasDirtyRegion = true; } if (y < dirtyMinY) { dirtyMinY = y; hasDirtyRegion = true; } int xW = x + w; if (xW > dirtyMaxX) { dirtyMaxX = xW; hasDirtyRegion = true; } int yH = y + h; if (yH > dirtyMaxY) { dirtyMaxY = yH; hasDirtyRegion = true; } }
private Rectangle getDirtyRectangle() { return new Rectangle(dirtyMinX, dirtyMinY, (dirtyMaxX - dirtyMinX), (dirtyMaxY - dirtyMinY)); }
private boolean isPartOfComponentTree(Component c, Component pane) { if (c == pane) return true;
if (pane instanceof Container) { if (((Container) pane).getComponentCount() == 0) return false;
for (Component cc : ((Container) pane).getComponents()) { if (cc == c) return true;
boolean b = isPartOfComponentTree(c, cc);
if (b) return true; } } return false; } } |
|
|
|
3
|
Java Game APIs & Engines / JOGL Development / Re: OpenGL pipeline on a linux platform bombs out when enabled.
|
on: 2007-08-23 10:58:04
|
The demo doesn't show the cube on my PC (Ubuntu 7.04, Java 1.6.0, ATI X1600 with the proprietary driver xorg-driver-fglrx 7.1.0-8.34.  . The other tests I did were with windows PCs and the demo-apps that come with the JDK - with the pipeline enabled, either the rotating cubes didn't show at all, or the screen flashed white the whole time. It seems that it is extremely important to have the right graphics card and the right drivers. It doesn't look like the pipline could be a stable solution yet.
|
|
|
|
|
ivj94
(583 views)
2018-03-24 14:47:39
ivj94
(48 views)
2018-03-24 14:46:31
ivj94
(374 views)
2018-03-24 14:43:53
Solater
(62 views)
2018-03-17 05:04:08
nelsongames
(109 views)
2018-03-05 17:56:34
Gornova
(151 views)
2018-03-02 22:15:33
buddyBro
(694 views)
2018-02-28 16:59:18
buddyBro
(92 views)
2018-02-28 16:45:17
xxMrPHDxx
(493 views)
2017-12-31 17:17:51
xxMrPHDxx
(733 views)
2017-12-31 17:15:51
|
java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org
|
|