Hi everybody, i am having hard times converting some code into opengl shaders since i am about to convert a big bulk of previous code into glsl.
My problem is the following:
when i pass the matrices ( sp?? ) in the vertex shader and do the computation like this :
gl_Position = (ProjectionMatrix * ViewMatrix * ModelMatrix) * in_Position ;
everything works fine
so my idea is to move the matrix calculation away from the vertex shader and perform the computation entirely on the cpu since the matrix doesn' changes trhough all the vertices sent to the graphics card
so i do something like this :
gl_Position = (ProjViewModelMatrix) * in_Position ;
the ProjViewModelMatrix is computed entirely on the CPU and i pass it trhough an uniform , the problem is that i get a blank screen if i use the simplest matrix possibile like this :
p[ 0]=s; p[ 1]=0; p[ 2]=0; p[ 3]=0;
p[ 4]=0; p[ 5]=s; p[ 6]=0; p[ 7]=0;
p[ 8]=0; p[ 9]=0; p=s; p=0;
p=0; p=0; p=0; p=1;
the model is drawn correctly but without a projection of course, but let's
perform a simple translation, this means that p=x, p=y,p= z;
now, if i put a value different from 1 in the p entry i get a blank screen
since the model is drawn away from the observer
how can i solve this problem ?
But better yet, how can i correctly perform computation to match the built in glsl matrix computations ?
i have looked around for tutorial but they always use the built in glsl matrix computations , i haven't seen anyone doing the computation on the cpu , at least not in a public forum or site.
Thanks for any suggestion i am driving nuts.