Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

shader modelview matrix problem

6 views
Skip to first unread message

keith

unread,
Dec 27, 2009, 5:12:56 PM12/27/09
to
With GL3.2, a vertex shader has less GL state available than before (in
non-compatible profile). Two of these states are the modelview and
projection matrices. The projection matrix usually changes less often
than the modelview matrix, so it's not a problem. But how about the
modelview matrix? Do I need to update the modelview matrix in _all_ my
shader programs with glUniformMatrix() every time the view changes if
using GL3.2 non-compatible profile?

BTW: Some people noted that one advantage of using GLSL shaders over Cg
shaders is having access to GL state inside the GLSL shaders. The
reduction of state one has access to perhaps negates this advantage of
using GLSL?

keith

unread,
Dec 27, 2009, 7:42:36 PM12/27/09
to
I've found the answer: it's bindable uniforms and named interface blocks.

So I pack some stuff into a BO and bind it to a uniform. My GLSL version
is only 1.30, so I cannot use named interface blocks. I was thinking to do:

uniform struct
{
mat4 mv_matrix;
mat4 proj_matrix;
} trans_matrices;

Maybe you follow some other idiom in your work?

keith

unread,
Dec 27, 2009, 10:12:47 PM12/27/09
to
I only have EXT_bindable_uniform, not GL_ARB_uniform_buffer_object, any
ideas what I should do?

aku ankka

unread,
Jan 10, 2010, 10:11:27 AM1/10/10
to
On Dec 28 2009, 5:12 am, keith <johndoe64...@yahoo.com> wrote:
> I only have EXT_bindable_uniform, not GL_ARB_uniform_buffer_object, any
> ideas what I should do?

It's not a big deal to just use mvp:

vec4 v = mvp * vertex_in;

.. and compute it yourself, need only a few matrix manipulation
functions, simple enough. Since we don't have separate mv and p, we
can't do lighting in view coordinates, but that's not really a problem
either.. it's less fuss to do it in model coordinates anyway. So less
stuff to compute.. simpler setup.. win-win. =)

0 new messages