hello everyone,
i just got the orange yesterday , and has i´m doing the 1st example in chapter6, i have a few problems with the uniform values to pass to either the vertex shader or the frag shader, now has i set up the shader with Shader Designer, it all works fine no problems, but has i try to make an opengl application, passing the uniform values to the shader i get this weired thing in my pattern.
My first thought is that probably i´m not passing the values right to the shaders, i have tried both ways for example, let´s say i have a Color to passand this color is a Color[3], wich means i have 3 float values to pass i can either do one of this 2 options:
//Uniform name in the shader : Color
loc1 = glGetUniformLocation(p,"Color");
//1st
//the "ugly" way
glUniform3fARB(loc1,lpos[0],lpos[1],lpos[1]);
//2nd
//the nicest way
glUniform3fvARB(loc1,1,lpos);
on my first way i just pass the values each one at the time,on the second i want to pass the color as a vector,wich seems no me a bit more accurate, as i choose the second aproach to pass uniforms values, crazy or not i get the same error in the shading.
Passing al my uniforms is done like this:
float BrickColor[3] ={1.0,0.3,0.2};
float MortarColor[3]={0.85,0.86,0.84};
float BrickSize[2]={0.3,0.2};
float BrickPct[2]={0.9,0.85};
loc1 = glGetUniformLocation(p,"LightPosicao");
//glUniform3fARB(loc1,lpos[0],lpos[1],lpos[1]);
glUniform3fvARB(loc1,1,lpos);
loc2 = glGetUniformLocation(p,"BrickColor");
//glUniform3fARB(loc2,BrickColor[0],BrickColor[1],BrickColor[2]);
glUniform3fvARB(loc2,1,BrickColor);
loc3 = glGetUniformLocation(p,"MortarColor");
//glUniform3fARB(loc3,MortarColor[0],MortarColor[1],MortarColor[2]);
glUniform3fvARB(loc3,1,MortarColor);
loc4 = glGetUniformLocation(p,"BrickSize");
//glUniform2fARB(loc4,BrickSize[0],BrickSize[1]);
glUniform2fvARB(loc4,1,BrickSize);
loc5 = glGetUniformLocation(p,"BrickPct");
//glUniform2fARB(loc5,BrickPct[0],BrickPct[1]);
glUniform2fvARB(loc5,1,BrickPct);
As you can see i prefer using a glUniform2fv than a glUniform2f and pass evey single value.
Let me show you a picture of the rendering:
any ideias on what´s going on?!
Thanks