Closed GoogleCodeExporter closed 9 years ago
@add - if I remove the above line, the artifacts do disappear but the rendering
is, of course, still wrong (see attached image).
Could it be something not working quite right with the vertex attributes?
Original comment by dimko...@gmail.com
on 24 Jun 2012 at 10:42
Attachments:
Ok, some progress - if I directly "hardcode" vgamma in the text.vert and keep
the gamma operation in the fragment shader, the display seems to be correct
(see attached image)
So, it is definitely something related to the vertex attribute (gamma)
Original comment by dimko...@gmail.com
on 24 Jun 2012 at 1:05
Attachments:
Ok, found the problem finally:
In the text.vert, attribute ashift should be defined before agamma. Currently
it is defined after it, and so the shader is mistakenly using ashift instead of
agamma and vice versa.
Original comment by dimko...@gmail.com
on 24 Jun 2012 at 1:15
Thanks, that was a quick bug report.
What bothers me is that you're right in saying ashift/agamme shoudl be swapped
but it does not make a difference on my machine. Weird. I'll try to understand
what's going on before applying your patch.
Original comment by Nicolas.Rougier@gmail.com
on 25 Jun 2012 at 1:06
I suppose some OpenGL implementations are just smarter than others.
Tonight I will try running the same code on Intel HD 3000, and report if it
behaves differently with regards to this issue.
Original comment by dimko...@gmail.com
on 25 Jun 2012 at 1:16
I think I'm wrong setting my own indices for generic attributes in the vertex
buffer code.
I was lucky it worked until now and I will have to find some other solution.
Original comment by Nicolas.Rougier@gmail.com
on 25 Jun 2012 at 2:53
JFYI - I just tried the shaders on Intel HD 3000 (Sandy Bridge) - and it works
regardless of the attribute order in the shader code, unlike NVidia.
Original comment by dimko...@gmail.com
on 25 Jun 2012 at 7:30
Actually my "workaround" does not work on ATI HD 6650M.
So, I guess reworking the vertex attribute code is the only proper way to fix
this.
Original comment by dimko...@gmail.com
on 2 Jul 2012 at 8:53
Ok, here is a quick and dirty fix,
Instead of having two generic attributes (shift, gamma) that might not get
mapped correctly, I just "piggybacked" those value in the texture coordinate
pointer.
I just extended the texture coordinate from 2 to 4 floats, and then use
gl_MultiTexCoord.z and w values to store and retrieve shift/gamma per-vertex
values.
Step 1: self->buffer = vertex_buffer_new( "v3f:t4f:c4f" );
Step 2: move shift/gamma floats up, below texture second coordinate in the
glyph_vertex_t structure, so they are part of the tex. coord 4-vector
Step 3: in the vertex shader:
vshift = gl_MultiTexCoord0.z;
vgamma = gl_MultiTexCoord0.w;
Of course, this is an ugly hack - but it will do at least for me until you
implement generic vertex attribute handling with glBindAttribLocation()
Original comment by dimko...@gmail.com
on 2 Jul 2012 at 9:55
There is a gl-3.0 branch that should fix the problem.
Original comment by Nicolas.Rougier@gmail.com
on 17 Sep 2012 at 7:18
Original issue reported on code.google.com by
dimko...@gmail.com
on 24 Jun 2012 at 10:38Attachments: