How games move around objects (in general)

I am sure that not only 1 answer to this, but do the game engines really change vectors in memory or use gltransformations? Since clicking and popping the matrix all the time seems inefficient, but if you keep changing the vertics, you cannot use display lists. Therefore, I wonder how this is done as a whole. Thanks

+3
source share
3 answers

Depends on your goals / objects.

Objects that never change are moved by setting matrices (this can be done using glRotatef / glTranslatef, etc.). This, of course, is faster than transforming the vertex of an object over a vertex. The object is stored in DisplayList, VertexArray or in VBO. You can send the entire object each time with the glVertex * command, but if the object never changes, there is no need for this.

Symbols (skinned / rigged) are converted using several matrices, which are usually processed by the vertex shader. You can do this on the processor if you want, but if you do not have a VERY advanced snap / skinning mechanism, there is no need for this.

, Videocard, CPU. , , ( ). , , , CPU. . OpenGL ( ), . , (.. , ) . , , , .

+3

.

, , , :

  • , , .. , . , , .. .

  • , OpenGL - , , .

  • OpenGL glDrawElements ( , Vertex). , , , . OpenGL, .

+3

Writing a matrix of 16 numbers on the stack is a trivial operation and, of course, much faster than changing the load of different vertices. Think about the number of vertices in a typical 3D model and you will understand why.

+1
source

Source: https://habr.com/ru/post/1749123/


All Articles