TeHa

07-03-2012, 06:27 AM

Hello folks,

I must say, I'm new to OpenGL ES 2.0 and I'm working on Android.

I've written a small vertex shader that implements the scaling and translation of my incoming vertices. Therefor I have a scaling-matrix (mat4 scale) given by

/ sx 0 0 0\

| 0 sy 0 0|

| 0 0 sz 0|

\ 0 0 0 1/

and a translation-vector (vec4 trans) given by:

/tx\

|ty|

|tz|

\1/

so gl_Position = (scale * Vertex) + trans;

but I thought it's easier to give both operations in just one matrix (mat4 proj), so that gpu has only to perform an multiplication and and not a multiplication AND addition. matrix4 looks like that:

/ sx 0 0 tx\

| 0 sy 0 ty|

| 0 0 sz tz|

\ 0 0 0 1/

so gl_Position = Vertex*proj;

Now the problem: the first way coordinate-tranformation works, but when I put both operations together in one martix nothing happens. dont' know what is going wrong? - please help!

I must say, I'm new to OpenGL ES 2.0 and I'm working on Android.

I've written a small vertex shader that implements the scaling and translation of my incoming vertices. Therefor I have a scaling-matrix (mat4 scale) given by

/ sx 0 0 0\

| 0 sy 0 0|

| 0 0 sz 0|

\ 0 0 0 1/

and a translation-vector (vec4 trans) given by:

/tx\

|ty|

|tz|

\1/

so gl_Position = (scale * Vertex) + trans;

but I thought it's easier to give both operations in just one matrix (mat4 proj), so that gpu has only to perform an multiplication and and not a multiplication AND addition. matrix4 looks like that:

/ sx 0 0 tx\

| 0 sy 0 ty|

| 0 0 sz tz|

\ 0 0 0 1/

so gl_Position = Vertex*proj;

Now the problem: the first way coordinate-tranformation works, but when I put both operations together in one martix nothing happens. dont' know what is going wrong? - please help!