简体   繁体   中英

OpenGL 4x4 Matrix move object by X-axis

I have an object in 2D scene in my iOS app. Position of the object is given by matrix

Vect3F translation = Vect3F(0.0f, 0.0f, 0.0f);

Matrix44F translationMatrix({
            1, 0, 0, translation[0],
            0, 1, 0, translation[1],
            0, 0, 1, translation[2],
            0, 0, 0, 1
});

I need to move the object by X-axis by 10 points. How do I achieve that? I am new to OpenGL.

You need to change translation vector. X coordinate is the first. Try this:

Vect3F translation = Vect3F(10.0f, 0.0f, 0.0f);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM