Top Description Inners Fields Constructors Methods
org.lwjgl.test

public Class Test_glGetVertexAttribPointer_API_bug

extends Object
Class Inheritance
Imports
org.lwjgl.BufferUtils, .LWJGLException, .PointerBuffer, org.lwjgl.opengl.Display, .GL11, .GL15, .GL20, java.lang.reflect.InvocationTargetException, .Method, java.nio.Buffer, .ByteBuffer, java.security.PrivilegedActionException

glGetVertexAttribPointer() is coded incorrectly. Any use of the buffer returned by glGetVertexAttribPointer() results in a JVM crash (SIGSEGV), because LWJGL is returning an offset as a DirectByteBuffer whose address is typically in the first page of memory. glGetVertexAttribPointer() should return a long, not a ByteBuffer.

The spec for glVertexAttribPointer says:

pointer

Emphasis mine. This is an offset into the VBO, not a native pointer.

Now look at glGetVertexAttribPointerv, which says:

Emphasis mine again. The spec clearly intends this to be an offset, not a pointer.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
pack-priv static class

Field Summary

Modifier and TypeField and Description
pack-priv static final Test_glGetVertexAttribPointer_API_bug.Attr[]
pack-priv static boolean
pack-priv static final int
pack-priv static Test_glGetVertexAttribPointer_API_bug.AttrGen
pack-priv static final Test_glGetVertexAttribPointer_API_bug.Attr
pack-priv static final Test_glGetVertexAttribPointer_API_bug.Attr
pack-priv static final int
pack-priv static final int
pack-priv static final Test_glGetVertexAttribPointer_API_bug.Attr

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
pack-priv static long
getBufferAddress(ByteBuffer buf)

Hack to call BufferUtils.getBufferAddress()

pack-priv static long
public static void
main(String[] args)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

attributesback to summary
pack-priv static final Test_glGetVertexAttribPointer_API_bug.Attr[] attributes
crashJvmback to summary
pack-priv static boolean crashJvm
FLOAT_BYTESback to summary
pack-priv static final int FLOAT_BYTES
genback to summary
pack-priv static Test_glGetVertexAttribPointer_API_bug.AttrGen gen
normalback to summary
pack-priv static final Test_glGetVertexAttribPointer_API_bug.Attr normal
positionback to summary
pack-priv static final Test_glGetVertexAttribPointer_API_bug.Attr position
strideback to summary
pack-priv static final int stride
strideBytesback to summary
pack-priv static final int strideBytes
textureCoordinatesback to summary
pack-priv static final Test_glGetVertexAttribPointer_API_bug.Attr textureCoordinates

Constructor Detail

Test_glGetVertexAttribPointer_API_bugback to summary
public Test_glGetVertexAttribPointer_API_bug()

Method Detail

getBufferAddressback to summary
pack-priv static long getBufferAddress(ByteBuffer buf) throws SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException

Hack to call BufferUtils.getBufferAddress()

glGetVertexAttribPointerback to summary
pack-priv static long glGetVertexAttribPointer(int index) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException
mainback to summary
public static void main(String[] args) throws LWJGLException, SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException, PrivilegedActionException
org.lwjgl.test back to summary

pack-priv Class Test_glGetVertexAttribPointer_API_bug.Attr

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv final int
pack-priv final String
pack-priv final int
pack-priv final int

Constructor Summary

AccessConstructor and Description
pack-priv
Attr(String name, int index, int size, int offset)

Method Summary

Modifier and TypeMethod and Description
pack-priv long
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

indexback to summary
pack-priv final int index
nameback to summary
pack-priv final String name
offsetback to summary
pack-priv final int offset
sizeback to summary
pack-priv final int size

Constructor Detail

Attrback to summary
pack-priv Attr(String name, int index, int size, int offset)

Method Detail

getByteOffsetback to summary
pack-priv long getByteOffset()
org.lwjgl.test back to summary

pack-priv Class Test_glGetVertexAttribPointer_API_bug.AttrGen

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv int

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv Test_glGetVertexAttribPointer_API_bug.Attr
allocAttr(String name, int index, int size)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

offsetback to summary
pack-priv int offset

Constructor Detail

AttrGenback to summary
pack-priv AttrGen()

Method Detail

allocAttrback to summary
pack-priv Test_glGetVertexAttribPointer_API_bug.Attr allocAttr(String name, int index, int size)