LWJGL
May 22, 2013, 13:08:03 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: LWJGL 2.9.0 released!
 
   Home   Help Search Login Register  



Pages: [1]
  Print  
Author Topic: [FIXED] NVTransformFeedback.glTransformFeedbackAttribsNV  (Read 1493 times)
Kai
Talks Too Much
***
Posts: 131


« on: December 02, 2011, 13: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.

Quote
 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
    attribute.

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

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.
Logged
Kai
Talks Too Much
***
Posts: 131


« Reply #1 on: December 03, 2011, 01: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.
Logged
spasi
Nerdus Imperius
*****
Posts: 752



WWW
« Reply #2 on: December 03, 2011, 03:11:19 »

Thanks Kai. Fixed on next nightly like so:

Code:
void glTransformFeedbackAttribsNV(@Constant("attribs.remaining() / 3") @GLsizei int count, @Check("3") @Const IntBuffer attribs, @GLenum int bufferMode);
Logged
Kai
Talks Too Much
***
Posts: 131


« Reply #3 on: December 05, 2011, 13:34:32 »

Thank you, for the quick fix!
Works as expected now.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines
SMFAds for Free Forums
Valid XHTML 1.0! Valid CSS!