Sunday 15 June 2014

c++ - glm lookAt and matrix transformation yielding odd behaviour -


I am using glm :: lookAt to get the matrix to change the world I am It works fine, I can generate the matrix, feed it in the shader, and all this works. What I need to do now is an arbitrary vector (i.e. 100,100,100,1) by matrix. For some reason, I get garbage value

  glm :: mat4 model = glm :: lookAt (glm :: vec3 (current_pos.x, current_pos.y, current_pos.z) ), Glm :: Vec3 (current_pos.x + dir.x, current_pos.y + dir.y, current_pos.z + dir.z), glm :: vec3 (up.x, up.y, up.z)) ; GLfloat fmodel [16] = {model [0] [0], model [0] [1], model [0] [2], model [0] [3], model [1] [0], model [1] Models [2] [1], models [2] [2], models [2] [1], models [1] [2], models [1] [3], models [2] [0] 2] [1] 3], model [3] [0], model [3] [1], model [3] [2], model [3] [3]}; Principal values ​​of   

model : 0,1,2,3,0,1,2,3,0,1,2, 3 , 0,1,2,3 I am computing the point using the model * vec4 (x, y, z, 1)

Matrix Duplicate So I can pass it as a uniform. Using both original matrix, the array produces a similar matrix.

Edit

The printing code is as follows:

 for  (unsigned I = 0; i   

This 3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 , Produces the output of 0,0,0 , even if my vectors are

< P> Strangely, after using glm :: value_ptr () rewriting large switches of code, it is now working

No comments:

Post a Comment