Answer the question
In order to leave comments, you need to log in
What does the ModelViewProjection matrix do in OpenGL ES 2.0?
Hello!
Working with shaders in Android, there was a slight dissonance in understanding what is happening, I can’t figure out what should be assigned to the gl_Position variable inside the shader.
Consider two cases:
1) I pass to the shader the coordinates of 3D points with coordinates lying inside the unit cube. Inside the vertex shader, I simply assign them (bringing them to a uniform look) to the gl_Position variable and when working, the Shader itself projects these points onto the screen plane in accordance with the current viewport.
2) Now let's say that I pass an attribute with 3D vertex coordinates and a Model-View-Projection matrix to the shader. By applying the MVP matrix to the vertex coordinates, I will get 2D coordinates on some plane (let's say they lie within some VGA image). And here a dissonance arises, how should this resulting plane and my current viewport be related, in what form should I put the received coordinates in gl_Position and what will the shader do next with these points before drawing, because there the coordinates are no longer limited to a single cube?
Can someone clarify these questions for me?
Thanks in advance!
Answer the question
In order to leave comments, you need to log in
The shader itself projects
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question