Hello everyone.
I have two (probably very noob-ish) questions.
- Can I change the content of a uniform multiple times without side-effects? Like this:
myShader.bind();
myShader.changeUniformMat4f(someUniformPointer,object0.objMat);
object0.draw();
myShader.changeUniformMat4f(someUniformPointer,object1.objMat);
object1.draw();
myShader.changeUniformMat4f(someUniformPointer,object2.objMat);
object2.draw();
myShader.unbind();
- I don’t understand matrix-multiplication very well, so, is this GLSL code correct?
void main(void)
{
// cameraMatrix, is the matrix of my camera, containing position and rotation.
// myObjectMatrix, is the matrix of a object in my world. It has a position and rotation.
gl_Position = gl_ProjectionMatrix * cameraMatrix * myObjectMatrix;
gl_TexCoord[0] = gl_MultiTexCoord0;
gl_FrontColor = gl_Color;
}
I hope I explained that well and understandable.
My english isn’t the best.
Please tell me about every mistake in the code and shader.
I wan’t to use this for my main-game project, so it has to be as bug-free as possible.
- Longor1996