Created attachment 36339 [details] Test case Using glVertexAttrib4f (or similar) to set a default vertex attrib value doesn't seem to work on the Mesa GLES 2 driver. Using glVertexAttribPointer to set an array value for the attribute for each vertex however seems to work fine. The attached test case tries to draw a red rectangle using a simple shader. The color is specified using a vertex attribute. For me the rectangle comes out black instead. If you change the #if 0 to #if 1 it will use glVertexAttribPointer instead and it seems to work. This is tested on my i965 with Mesa git 118a476. I can't test with any later commit because Mesa just gives an assert for all programs after that (but I guess that's a separate issue). This causes Clutter to display text in black when the string is long enough to use a VBO instead of going through the journal (such as in text-text).
This appears to be fixed in git master
I just noticed that calling glVertexAttrib with attrib location zero doesn't work. I think on big GL there is no generic value for location zero and glVertexAttrib with 0 should only be called between glBegin and glEnd. As far as I can tell this restriction doesn't apply for GLES2 so it should work. This is a pain for Cogl because I want to be able to let the driver determine the attribute locations for itself and then later query them with glGetAttribLocation. We sometimes need to set the color attribute using the generic value but if the compiler happens to place the color in attribute 0 then it won't work.
Created attachment 40868 [details] [review] Fix GLES2 glVertexAttrib Does this patch help? It fixes the test case when ATTRIB_COLOR is 0 and ATTRIB_POSITION is 1. It would be great if someone more familiar with the vbo module can review it.
Why do the color/normal/texcoord functions need to be renamed?
(In reply to comment #4) > Why do the color/normal/texcoord functions need to be renamed? Just for consistency (s/_vbo_/_es_/). If it looks good otherwise, I could separate the renames and the real fix into two commits.
(In reply to comment #5) > (In reply to comment #4) > > Why do the color/normal/texcoord functions need to be renamed? > Just for consistency (s/_vbo_/_es_/). If it looks good otherwise, I could > separate the renames and the real fix into two commits. OK, maybe just note in the commit message that the other renaming was done for consistency.
Yup, the patch works here. Thanks for the quick response.
Committed as 98ee6739d97b5592a7dad0b453c78e180a51ad50, with more descriptive commit message.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.