Are glGetUniformLocation and glGetAttribLocation time consuming?
Which way is better?
- Call
glGetAttribLocationorglGetUniformLocationevery time I need it ? - Store locations in varables and use them when needed ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Whether on Android or iPhone, for an opengl surface you will have methods like:
onSurfaceCreated and onSurfaceChanged,
get into the habit of fetching uniforms and attributes here in these 2 methods.
The only way you can make rendering faster (which will soon become your priority when your code crosses 1000 lines of code) is by only having gluseprogram, glbindbuffer, texture binds and other binds inside onDrawFrame method, always cache variables inside onSurfaceCreated and onSurfaceChanged