OpenGL: What does glRotatef rotate?

When I call glRotatef as follows:

 glRotatef(angle,0.0,1.0,0.0) //rotate about y-axis 

I know that it should rotate angle degrees around the y axis .
But what revolves here? Which object?

Probably a stupid question, but I'm completely new to this.

I managed to rotate the line around this endpoint using the answer here , but I really don't understand how it works inside.

+5
source share
2 answers

Nothing rotates because OpenGL does not "save" objects.

glRotatef, like glMultMatrixf, is used to modify the selected transformation matrix. This affects how they are done in the future. One sets up the matrices (and other things!), As you want, and then draws one object.

For more information, see Redbook and OpenGL for the difference between “saved mode” and “immediate mode”.

+6
source

glRotate will act on the current matrix, which is GL_MODELVIEW by default. This will affect any 3D object that you draw in sequence. The current matrix is ​​modified using glMatrixMode . The model view matrix is ​​then applied to any geometry displayed with glVertex , glDrawArrays , etc.

OpenGL side matrices are now deprecated. If you are using the main OpenGL 3+, these features are no longer available. If you are new to OpenGL, I suggest you skip learning about old ways and focus on modern, OpenGL-oriented shaders. You can check the following links for some good guides.

+2
source

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


All Articles