My program contains two shader programs in it. The following code is for preparing one of the shader program's attributes:
int positionHandle2 = glGetAttribLocation(programAColorUTranslate, "vPosition"); glEnableVertexAttribArray(positionHandle2); glVertexAttribPointer(positionHandle2, 2, GL_FLOAT, GL_TRUE, 2 * sizeof(float), 0); translateHandleAColorUTranslate = glGetUniformLocation(programAColorUTranslate, "vTranslate"); int aColorHandle = glGetAttribLocation(programAColorUTranslate, "aColor"); glEnableVertexAttribArray(aColorHandle); /*glVertexAttribPointer(aColorHandle, 3, GL_FLOAT, GL_TRUE, 5 * sizeof(float), 0);*/
At this point, the program works fine, except that the vertices drawn by the above shader program are not colored, since the line above is commented out. However, if I uncomment the line above (and change the stride of position handle to 5 * sizeof(float)) to try to add colors to the above shader program's vertices, random shapes appear in my program. Supposedly, the above line should only alter triangles rendered by one of the shader programs, not both. However, every single vertex in my program is being rendered incorrectly after uncommenting the about line, to the point that the program becomes unrecognizable from before.