opengl es shader program id and vbo buffer id are same
I am drawing 2 triangles in opengl es 2.0 using vbo.
the program handle (hProgramHandle)
hProgramHandle = glCreateProgram(); // value is 210003
is same as the iVertBuffId
glGenBuffers(1, &iVertBuffId1); // for vertices // 70001
...
...
glGenBuffers(1, &iVertBuffId2); // for color // 140002
...
...
glGenBuffers(1, &iVertBuffId3); // for texture // 210003
I have created 3 buffers (each for position, color and texture). The above issue is coming while generating the buffer for the texture.
I am not getting the output.
Will opengl generate the same number for the program id and vbo buffer id?
Ids returned by OpenGL are in fact names refering to its internal storage. Internal OpenGL storage is divided by speciality, so it can optimize its memory access at will. Where this is counter-intuitive is that ids are in fact not unique, but rather dependant on what you are talking about to OpenGL : eg what is currently bound.
It is absolutely correct for OpenGL to give you identical ids, as long as they refer to something different : texture ids and buffer ids can overlap, that's not a problem.
Remark that they may or may not overlap, and begin by 0 in order or simply give you what seems to be random numbers, that is implementation dependant.
That is dependent on the implementation of the particular OpenGL ES driver you are running, but yes the values can be the same because they are handles to different types of objects and not necessarily memory pointers. Think of them as indexes into different data structures.
链接地址: http://www.djcxy.com/p/52432.html