Suggestions

Started by spasi, October 10, 2003, 12:41:21

Previous topic - Next topic

spasi

The ARB_fragment_program extension is missing from LWJGL. Could you add it please?  :roll:

I also have a suggestion to make: Many standard GL constants, like GL_TEXTURE0, have a duplicate in the corresponding extension that defines them (for the example: GL_TEXTURE0_ARB in ARB_multitexture). They both have the same (integer) value. I think the _ARB one could be removed, if there isn't any serious reason to keep it (that I can't think of). It doesn't create any problems, but there are many duplicate constants that, if removed, would nicely clean up LWJGL.

I hate it when autocompletion puts the wrong one...  :twisted:

elias

ARB_fragment_program should be added now. Actually, no functions were added, only the GLCaps entry and the ARBFragmentProgram interface.

I'm not sure I agree with that constants should be coalesced. It happens that the constant names are the same (barring the _ARB) but the extension specs might be slightly different. And they're still defined in different places. I use

GLConstants13.GL_CONSTANT

when I want to mark that I use an OpenGL 1.3 feature, and

GLConstants.GL_CONSTANT_ARB

when I want the ARB extension. The constants have the same value, but different meaning.

- elias

spasi

There is a problem with the ARB_vertex_buffer_object extension. The glBufferDataARB is messed up. In the LWJGL test classes mapping is used to init the buffer object (BufferDataARB is used only once, passing a null buffer), so the error was not visible there... Anyway, here's what's wrong:

Java:

public static void glBufferDataARB(int target, int size, FloatBuffer data, int usage) {
     nglBufferDataARB(target, size, data, data != null ? data.position()<<2 : 0, usage);
}


and C:

JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL_nglBufferDataARB(JNIEnv *env, jclass clazz, jint target, jint size, jobject buffer, jint usage, jint buffer_offset) {
      CHECK_EXISTS(glBufferDataARB)
      const GLvoid *address = (const GLvoid *)safeGetBufferAddress(env, buffer);
      glBufferDataARB((GLenum)target, (GLsizeiptrARB)size, address, (GLenum)usage + buffer_offset);
      CHECK_GL_ERROR
}


The native code is wrong. It should be:

JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL_nglBufferDataARB(JNIEnv *env, jclass clazz, jint target, jint size, jobject buffer, jint buffer_offset, jint usage) {
      CHECK_EXISTS(glBufferDataARB)
      const GLvoid *address = (const GLvoid *)safeGetBufferAddress(env, buffer);
      glBufferDataARB((GLenum)target, (GLsizeiptrARB)size, address + buffer_offset, (GLenum)usage);
      CHECK_GL_ERROR
}


And Elias...you forgot two tokens in fragment_program  :roll: , FRAGMENT_PROGRAM_ARB and PROGRAM_FORMAT_ASCII_ARB (the first two in the specification).

elias

Thank you, both bugs should be fixed now!

- elias