[FIXED] NVTransformFeedback.glTransformFeedbackAttribsNV

Started by Kai, December 02, 2011, 21:44:53

Previous topic - Next topic

Kai

The current implementation of the method 'glTransformFeedbackAttribsNV' in NVTransformFeedback provides a wrong first parameter to the native function nglTransformFeedbackAttribsNV.
The specification states that the first parameter to nglTransformFeedbackAttribsNV is effectively the remaining ints of the IntBuffer (in the LWJGL method glTransformFeedbackAttribsNV) divided by 3 and not the actual number of remaining ints, since the values in the IntBuffer/int* are interpreted as triples.

Quotevoid TransformFeedbackAttribsNV(sizei count, const int *attribs,
                                     enum bufferMode)
   This command specifies which attributes to record into one, or more,
   buffer objects. The value TRANSFORM_FEEDBACK_BUFFER_MODE_NV will be set
   to <bufferMode> and the value TRANSFORM_FEEDBACK_ATTRIBS_NV set to
   <count>.  The array <attribs> contains an interleaved representation of
   the attributes desired to be fed back containing 3*count values. For
   attrib i, the value at 3*i+0 is the enum corresponding to the attrib, as
   given in table X.2. The value at 3*i+1 is the number of components of the
   provided attrib to be fed back and is between 1 and 4. The value at 3*i+2
   is the index for attribute enumerants corresponding to more than one real
   attribute.

This results in "an org.lwjgl.opengl.OpenGLException: Invalid enum (1280)" OpenGL Exception in the following code:

IntBuffer ib = BufferUtils.createIntBuffer(3);
ib.put(0, GL11.GL_POSITION);
ib.put(1, 4);
ib.put(2, 0);
NVTransformFeedback.glTransformFeedbackAttribsNV(ib, NVTransformFeedback.GL_SEPARATE_ATTRIBS_NV);


The exception is being raised after invocation of the 'glTransformFeedbackAttribsNV' method. All other setup code works correctly.

Kai

Okay, I patched my local LWJGL svn working copy by introducing another attribute ("int divider()") in the AutoSize annotation, which will be processed by the JavaMethodGenerator and when != 1 will divide the .remaining() of the IntBuffer by that number.

This way it works fine for me.

spasi

Thanks Kai. Fixed on next nightly like so:

void glTransformFeedbackAttribsNV(@Constant("attribs.remaining() / 3") @GLsizei int count, @Check("3") @Const IntBuffer attribs, @GLenum int bufferMode);

Kai

Thank you, for the quick fix!
Works as expected now.