I am trying to use glVertex4f in a display list and it’s crashing JOGL out. If I remove the call to glVertex4f() by replacing with glVertex3f()…all is good…except that’s not what I want. I tried using glVertex4fv instead and it also crashes.
Here is the code (JOGL 1.1b12):
making_name = true, is_static = true
if (drawCaps) {
if (is_static && making_name) {// Only do this once if static
// Make a display list for speed
static_shadowcap_name = gl.glGenLists(1);
gl.glNewList(static_shadowcap_name, GL.GL_COMPILE);
making_name = true;
} else if (is_static && !making_name) {
// display the list
gl.glCallList(static_shadowcap_name);
return;
}
// Draw shadow caps
gl.glBegin(GL.GL_TRIANGLES);
{
for (int i = 0; i < numTriangles; ++i) {
for (int j = 0; j < 3; ++j) {
Point3f vertex = vertices[indices[i * 3 + j]].position();
if (isFacingLight[i])
gl.glVertex3f(vertex.x, vertex.y, vertex.z);
else {
gl.glVertex4f(vertex.x - lightPosition.x, vertex.y
- lightPosition.y, vertex.z - lightPosition.z, 0.0f);
}
}
}
}
gl.glEnd();
if (making_name)
gl.glEndList();
}
Here is the stack trace:
An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x7C910E03
Function=wcsncpy+0x374
Library=C:\WINDOWS\system32\ntdll.dll
Current Java thread:
at net.java.games.jogl.impl.windows.WindowsGLImpl.glVertex4f(Native Method)
at com.vorax.geometry.ShadowRendererB.drawShadow(ShadowRendererB.java:391)
at com.vorax.Renderer.display(Renderer.java:556)
- locked <0x11496f18> (a java.lang.Object)
at net.java.games.jogl.impl.GLDrawableHelper.display(GLDrawableHelper.java:74)
at net.java.games.jogl.GLCanvas$DisplayAction.run(GLCanvas.java:241)
at net.java.games.jogl.impl.GLContext.invokeGL(GLContext.java:283)
- locked <0x11444468> (a net.java.games.jogl.impl.windows.WindowsOnscreenGLContext)
at net.java.games.jogl.impl.windows.WindowsOnscreenGLContext.invokeGL(WindowsOnscreenGLContext.java:79)
at net.java.games.jogl.GLCanvas.withSingleThreadedWorkaroundDo(GLCanvas.java:228)
at net.java.games.jogl.GLCanvas.display(GLCanvas.java:75)
at com.vorax.VoraxEngine.doGameLoop(VoraxEngine.java:441)
at com.vorax.VoraxEngine.startGame(VoraxEngine.java:419)
at com.vorax.VoraxEngine.engineLoop(VoraxEngine.java:1053)
at Exigent.main(Exigent.java:84)