How to use glOrtho() in OpenGL?

Have a look at this picture: Graphical Projections  The glOrtho command produces an “Oblique” projection that you see in the bottom row. No matter how far away vertexes are in the z direction, they will not recede into the distance. I use glOrtho every time I need to do 2D graphics in OpenGL (such as health bars, menus … Read more

glm rotate usage in Opengl

You need to multiply your Model matrix. Because that is where model position, scaling and rotation should be (that’s why it’s called the model matrix). All you need to do is (see here) Note that to convert from degrees to radians, use glm::radians(degrees) That takes the Model matrix and applies rotation on top of all the operations that are … Read more

How to solve stbi_load error of “no SOI”?

I’m loading a picuture by stbi_load, but there was an error of no SOI. I had used the picture in another project and it was loaded successfully. So I think the path of picture and the picuture is valid. But I don’t know why the error occured? Here are some of the main code: I use loadTextureFromFile(“./Data/awesomeface.png”, GL_TRUE); to … Read more

What does it mean to normalize a value?

It’s a mathematical term and this link explains its meaning in quite simple terms: Operations in 2D and 3D computer graphics are often performed using copies of vectors that have been normalized ie. converted to unit vectors… Normalizing a vector involves two steps: calculate its length, then, divide each of its (xy or xyz) components by its length…

understanding glVertexAttribPointer?

@datenwolf already covered the key aspect in a comment above. To elaborate some more: You do not have to bind GL_ARRAY_BUFFER again before the glDrawElements() call. What matters is that the buffer you want to source a given attribute from is bound when you make the glVertexAttribPointer() call for that attribute. The best way to picture this is that when you make this … Read more

Why use ‘glad’ library for opengl initialization? [duplicate]

Authors suggest there to use GLAD library, because this library provides creation of GL context (which does not fit me) No, GLAD does not create or manage GL contexts in any way, and the website https://learnopengl.com/Getting-started/Creating-a-window never claims otherwise. They use GLFW for context and window management. Does compiler really cannot get addresses of Opengl functions from … Read more

What exactly is a VBO in OpenGL?

I think you are mixing up lots of different things and have several confusions, so I’m try to work through most of them in the order you brought them up: when we declare a series of vertices, let’s say 3 vertices that form a triangle primitive, we basically store those nowhere, they’re simply declared in … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)