i get all variables when i create shader and after i compile it. (this is for faster access and dont using glGetUniformLocation ro attrib location at run-time in every call of function) .
glGetActiveUniform works correctly and return true numbers but glGetActiveAttrib return a wrong number.
There is no “wrong number” to OpenGL; if you do not specify particular attribute values with the API that elFarto described, it will assign them arbitrarily. So if your program needs “in_Position” to be attribute number 0, then you must set it to attribute number 0.
i want just to get currect attribs id. and no more.
The function you used did return the correct attribute ids. You said that:
returned values:
in_Position: 1
in_Color: 0
Because you did not specifically assign those attribute values to a particular index, OpenGL is free to give them whatever attribute index it wants. Thus, what this function returns is what attribute index OpenGL assigned to that attribute.
After that, you said.
but it must be return:
in_Position: 0
in_Color: 1
If you need in_Position to have an attribute index of 0, then you must tell OpenGL to give it an attribute index of 0. Otherwise, OpenGL is free to assign it whatever attribute index it wants.