GLVertexBuffer::addUniform unfinished GLMatrix support

Bug #1543874 reported by John
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Compiz
New
Undecided
Unassigned

Bug Description

I was writing a shader for a compiz plugin, and couldn't work out why my matrices uniforms were not working. A few hours later of test-apps and digging through the compiz source I found:

```
bool GLVertexBuffer::addUniform (const char *name, const GLMatrix &value)
{
    //#warning Add 'addUniform' support to GLMatrix type !
    return true;
}
```

I would expect this to: (a) fail loudly, perhaps printing a warning to the console or (b) actually work! :-)

Fixing it looks to be a simple case of making a new Uniform<double, 16> and copying the GLMatrix into it. Best guess is this would do the trick...

Line 250 vertexbuffer.cpp
```
void GLVertexBuffer::addUniform (const char *name, GLMatrix &value)
{
    // we're casting to double here to make our template va_arg happy
    Uniform<double, 16>* uniform = new Uniform<double, 16>(name,
        (double)value[0], (double)value[1], (double)value[2], (double)value[3],
        (double)value[4], (double)value[5], (double)value[6], (double)value[7],
        (double)value[8], (double)value[9], (double)value[10], (double)value[11],
        (double)value[12], (double)value[13], (double)value[14], (double)value[15]);
    priv->uniforms.push_back (uniform);
}
```

Line 85 privatevertexbuffer.h
```
case 16: {
    GLMatrix m;
    for (int i = 0; i < 16; ++i)
        m[0] = (float)a[0];
    prog->setUniform (n, m);
    break;
}
```

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.