How do I use unpackHalf2x16?

Posted by user1032861 on Game Development See other posts from Game Development or by user1032861
Published on 2013-10-26T19:48:33Z Indexed on 2013/10/26 22:17 UTC
Read the original article Hit count: 239

Filed under:
|
|

I'm trying to use (un)packHalf2x16, without success so far. I'm drawing with:

glVertexAttribIPointer(0, 2, GL_UNSIGNED_INT, 0, 0);
glEnableVertexAttribArray(0);
glBindBuffer(GL_ARRAY_BUFFER, vbo);
glDrawArrays(GL_POINTS, 0, n_points);
glDisableVertexAttribArray(0);

and on the shader

#version 330 core
#extension GL_ARB_shading_language_packing : require
in uvec2 A0;
// (...)
vec4 t = vec4(unpackHalf2x16(A0.x), unpackHalf2x16(A0.y));

But nothing gets drawn. I'm pretty sure buffer's content is right, and if I use vec4 t = vec4(0); I can see it's working properly. How is this packing / unpacking thing supposed to work? I can't find any example.

© Game Development or respective owner

Related posts about opengl

Related posts about shaders