Hello Guest

[FIXED] NVTransformFeedback.glTransformFeedbackAttribsNV

  • 3 Replies


[FIXED] NVTransformFeedback.glTransformFeedbackAttribsNV
« on: December 02, 2011, 21:44:53 »
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.

 void 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

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

Code: [Select]
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.
« Last Edit: December 05, 2011, 21:26:48 by kappa »



Re: [BUG] NVTransformFeedback.glTransformFeedbackAttribsNV
« Reply #1 on: December 03, 2011, 09:30:06 »
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.


Offline spasi

  • *****
  • 2160
    • WebHotelier
Re: [BUG] NVTransformFeedback.glTransformFeedbackAttribsNV
« Reply #2 on: December 03, 2011, 11:11:19 »
Thanks Kai. Fixed on next nightly like so:

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



Re: [FIXED] NVTransformFeedback.glTransformFeedbackAttribsNV
« Reply #3 on: December 05, 2011, 21:34:32 »
Thank you, for the quick fix!
Works as expected now.