glVertexAttribIPointer(int, int, int, int, long)?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

glVertexAttribIPointer(int, int, int, int, long)?

darren
Hi All,

Apologies if I am just completely missing the point on this one but after reading the OpenGL spec, I was expecting JOGL to offer a glVertexAttribIPointer(int, int, int, int, long) method and a glVertexAttribLPointer(int, int, int, int, long) method in the same way that if offers the glVertexAttribPointer(int, int, int, boolean, int, long) method. Is there another way to get this functionality that I am missing?

I noticed that JOGL does provide versions of these methods that accept GLArrayData objects. Does this provide what I am after? If so, is there a good place to go where I can find information on how to use these calls to pass integer attribute values to the vertex shader from buffers?

Thanks in advance,

Darren.
Reply | Threaded
Open this post in threaded view
|

Re: glVertexAttribIPointer(int, int, int, int, long)?

Wade Walker
Administrator
Hi Darren,

Have you tried these two methods in the GL4 profile? They're defined in jogamp.opengl.gl4.GL4bcImpl.

public void glVertexAttribIPointer(int index, int size, int type, int stride, Buffer pointer)
public void glVertexAttribLPointer(int index, int size, int type, int stride, Buffer pointer)

I haven't done it myself, but it looks like you should be able to use the NIO Buffer objects the same way you would the GLVoid * arguments in the C spec.
Reply | Threaded
Open this post in threaded view
|

Re: glVertexAttribIPointer(int, int, int, int, long)?

darren
Hi Wade,

Thanks for the reply. I think I might be missing something in how the buffer objects are being used. My understanding was that the pointer in the c spec was basically just an integer offset into the bound VBO.  That is why I was looking for a pointer parameter of type long. Have I got this wrong? I am a bit confused as to how to get the same result by providing a buffer object. The examples I can find seem to be using the buffer pointer parameter to actually specify the content of the VBO but in my case the buffer is already defined and filled.

Could you provide a short example showing how the buffer should be used in this case?

Thanks again,

Darren.
Reply | Threaded
Open this post in threaded view
|

Re: glVertexAttribIPointer(int, int, int, int, long)?

Wade Walker
Administrator
Ah, I see what you mean now. It might be that gluegen is doing the wrong thing for this particular use of type GLVoid *. Usually pointer types need to be Buffers of some kind in Java, but the spec does seem to imply that in this case, you're supposed to just cast an int to (GLVoid *) and pass that in.

Looking at the JNI code for these functions, it looks like a Buffer of null will be passed to the C function as a zero offset, but there's no way to get a non-zero offset with the current JNI code. You might want to enter a bug report on this one so we'll know that we need to tell gluegen to treat GLVoid * differently in this case.

I think there is some way to override the JNI code generation on a per-function basis in gluegen, but I haven't looked at that part of the codebase. Maybe Sven or Michael can provide some insight here.

Reply | Threaded
Open this post in threaded view
|

Re: glVertexAttribIPointer(int, int, int, int, long)?

Sven Gothel
Administrator
On Thursday, June 09, 2011 03:01:08 AM Wade Walker [via jogamp] wrote:
> glVertexAttribIPointer


Thank you for the heads up, will check these days.

Sorry guys, was swamped w/ the usual release troubles,
updated jenkins, made a new plugn for XML 'false' errors of unit tests
and now still troubled with Ubuntu 11.04 and ATI Catalyst :(

.. well, will give it all another shot tomorrow.

Cheers, Sven