简体   繁体   中英

On Display Lists and Polygon Faces

For reference to code discussed, see: StrixaGL Library on Github


I have two critical issues in my library at the moment that I don't understand what's happening and was hoping you guys could help me with. First, using display lists (See the com.strixa.gl.Strixa3DElement#draw method) without a texture works perfectly fine. And using a texture without using display lists works perfectly fine as well. What I'm not sure of though, is when using them both. If both are used, the JVM crashes here at line 145 with the following error:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000000007173ffe0, pid=5104, tid=7284
#
# JRE version: 7.0_05-b05
# Java VM: Java HotSpot(TM) 64-Bit Server VM (23.1-b03 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C  [atio6axx.dll+0x129ffe0]  atiPS+0xd8010
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of   Windows
#
# An error report file with more information is saved as:
# D:\User Data\My Documents\Eclipse Workspace\git\firepenguindiscopanda\fpdp_applet\bin\hs_err_pid5104.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.sun.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

And I can provide the crash dump as well, if you would like to see that. I've never had to deal with a JVM crash before, so I have little idea about what might be going on other than the native OpenGL dll is crashing causing the JVM to crash.

Secondly, when I do have my textures drawing (by disabling the display lists portion of my code), the textures are drawn on the wrong face of the polygons. I've tried using GL2#glFrontFace with both GL2#GL_CW and GL2#GL_CCW to change the winding order, but neither of these things worked and the textures were still drawn on the (from my perspective) back faces. Then I tried manually reversing teh order the points were being added. That did nothing as well. Consequently, this also affects lighting, as any objects drawn will be lit from the inside, rather than the outside.

Might anyone have any idea what's going on here?


Update


First of all, here is a more clearly defined image of what's happening:

在此输入图像描述

(The front wall (The wall nearest to the viewer), outlined in red is, seemingly invisible. Yet the rear wall, is completely opaque. In this case, I've even added surface normals so that the faces should be correct. Not only that, but I've enabled lighting and set the cube being drawn to a blue color. Sadly however, that's not what I'm seeing. Perhaps this will give someone a bit more insight into my problem.

Also, in case you're curious as to what I'm loading, here's the contents of the OBJ file:

# Blender v2.63 (sub 0) OBJ File: ''
# www.blender.org
mtllib pony.mtl
o Cube
v -1.000000 -1.000000 1.000000
v -1.000000 -1.000000 -1.000000
v 1.000000 -1.000000 -1.000000
v 1.000000 -1.000000 1.000000
v -1.000000 1.000000 0.999999
v -0.999999 1.000000 -1.000001
v 1.000000 1.000000 -1.000000
v 1.000000 1.000000 1.000000
vn -0.000000 -1.000000 0.000000
vn 0.000000 1.000000 -0.000000
vn -1.000000 0.000000 -0.000000
vn 0.000000 -0.000000 -1.000000
vn 1.000000 -0.000000 0.000000
vn -0.000000 0.000000 1.000000
usemtl Material
s off
f 1//1 2//1 3//1 4//1
f 5//2 8//2 7//2 6//2
f 1//3 5//3 6//3 2//3
f 2//4 6//4 7//4 3//4
f 3//5 7//5 8//5 4//5
f 5//6 1//6 4//6 8//6

And the contents of the MTL file:

# Blender MTL File: 'None'
# Material Count: 1
newmtl Material
Ns 96.078431
Ka 0.000000 0.000000 0.000000
Kd 0.000000 0.011431 0.640000
Ks 1.000000 1.000000 1.000000
Ni 1.000000
d 1.000000
illum 2

Second of all, in response to olamedia: Here is the dump: link because of character limit


Update[1]


Fixed my issue of polygons being drawn incorrectly by reversing my 'near' and 'far' parameters on gluPerspective. Now the issue at large is the crash, and why it's occurring.


Update[2]


Fixed the issue with the driver crashing. If I move the code to load the texture out of the display list, it works fine.

It looks like this is a crash in the ATI driver. The telltale is atio6axx.dll . The standard thing to try is update your driver to newest you can find.

Textures that don't look right are almost always due to texture coordinates that aren't what you think they are. It's not clear what you mean by "the wrong faces of the polygons." Post a picture to show us what you mean.

Added after poster's addition

As we discussed, this is a culling problem. When near and far are flipped, the Z-component of the normals is reversed, and culling is reversed. Front faces are culled and back faces are kept. That's exactly what your picture shows.

The complete dump you posted shows clearly that the crash is inside the driver's display list render code, which should never crash. That is, it's a driver bug. Try your applet on other machines to see if it runs.

Otherwise you'll have to post code before we can help further. Though the driver shouldn't crash, it's more likely to do so if there's something not right about the calling display list recording or playback code.

Display List is just a list of instructions.

EDIT: Post hs_err_pid5104.log here. As it contains the real error message.

GL crushing because (I suppose) u're using debug flags for jogl. Without flags all gl errors will be ignored.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM