Tuesday, January 28, 2014

opengl es 2.0/opengl4 porting

ES 2.0 is a subset of GL 3/4. We know there is no geometry shader in ES. When I tried to porting my GL4 code to ES 2.0. I found another problem. There is no glVertexAttribIPointer or glVertexAttribLPointer to pass integer buffer to the vertex shaders. All the vertex buffers have to be passed with glVertexAttribPointer with different types. In my code, ivec3/ivec4 will not get correct values from glVertexAttribPointer. I have to use vec3/vec4 to get buffers. And then, cast them to int to use, like int(foo[0]). So far, it works fine, but I am not sure if there is any performance overhead while type casting from float to int, or there is any better solution.

No comments:

Post a Comment