opengl - Does OpenGL3+ admit a specific state to render 2D-only graphics? -


I am currently working on 2D graphics, and as far as I can tell every head, it is finally 4D Point is processed as homogeneous place so I say to myself: waste of resources! I assemble that the hardware is essentially designed to handle 3D scenes, and such that 4D can be difficult to make linear algebra. Still, there is a way to write the shaders (or enable a group of options) so that only the actual 2D coordinates can be used in hard memory? I know that two 2x2 matrix can be embedded in a 4x4 matrix, but gl_Position is going to be a vec4 , where the track starts ending. I'm not looking at any kind of "workaround" hack, but it's not a legal way to make OpenGL like a specific way / state.

I did not know whether there is a simple mention of such a fact on the sample code or pure, so I should collect / not be impossible, say, what is it for display reasons?

Modern GPUs are actually scalar architecture. In GLSL you can write less vectors. vec2 is a completely valid type and you can create the top array with only two scaler elements per vector, as size

vec4 (v, [0, [0]], 1) for any data passed internally as the top attribute of the dimension; 4.

In the top shider you have to assign vec4 to gl_Position . But you can extend a vec2 to a vec4 :

  vec2 v2; Gl_Position = vec4 (v2, 0, 1); Yes,  gl_Position  should always be an  vec4 , due to the fact that the OpenGL clip specifies operations in space. But this is not exactly the obstacle in reality. 


Comments