[Help] OpenGL for 3D Object Transformation
so far i able to create a Stand Still 3D Object, about the transformation Matrices i Already learn that the problem is to Implemented it into a code.Thanks btw
If that's the case, it should be simple. In 3D graphics you usually have 4different spaces: model space, world space, camera space and screen space.
Model space is the space the model is in when you load it.
World space is where the model is in world, how it's rotated and how it's scaled.
Camera space is basically same as world space, only relative to the camera.
Screen space is where coordinates resemble pixels on the screen.
To go from one space to another you need to transform the vertices by a matrix.
Model space --ToWorldMatrix--> World space --ViewMatrix--> Camera space --ProjectionMatrix--> Screen space.
luckily you can concatenate these matrices together into a single matrix, so you don't have to transform all the vertices 3 times.
This can be done by multiplying them together: Matrix = ProjectionMatrix * ViewMatrix * ToWorldMatrix NOTE: order is important.
In the vertex shader you simply do gl_Position = Matrix * vertex to convert it to screen space.
The only trick left is to construct the ToWorldMatrix from a position, scale and rotation. This shouldn't be too difficult and can be easily found on the internet.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now