Reputation: 49
OpenGLes 2.0 does not have support for special built-in fragment shader variable called gl_PrimitiveID. I tried to simulate this variable by associating a unique attribute with each of the vertices forming a triangle. But this causes problem when there is sharing of vertices between two or more triangles. It would effectively require duplication of shared vertices for this technique to work increasing memory usage for complex scenes.
I am thinking to make changes in the openGLes library itself so as to be able to maintain gl_PrimitiveID variable internally. I am using mesa 3d library for editing the source code of openGLes 2.0. But I am not able to locate the implementation of glDrawElements to serve my purpose. This function has GL_APIENTRY flag associated with its declaration.
Any suggestions?
Upvotes: 0
Views: 474
Reputation: 162164
OpenGL or OpenGL-ES are not libraries. They're system level APIs, which implementation is buried deep within the GPU's driver. You can't make changes to them, without messing around in a GPU driver's code. And then everybody who used your program had to use that driver. Which in the case of OpenGL-ES will be impossible to carry out, because most OpenGL-ES implementations live in devices that build walled gardens around applications. Also the driver's source codes are usually kept a secret.
Upvotes: 1