What does “immediate mode” mean in OpenGL?

One example of “immediate mode” is using glBegin and glEnd with glVertex in between them. Another example of “immediate mode” is to use glDrawArrays with a client vertex array (i.e. not a vertex buffer object). You will usually never want to use immediate mode (except maybe for your first “hello world” program) because it is … Read more

How does the fragment shader know what variable to use for the color of a pixel?

Furthermore, we have a predefined gl_FragColor. Let’s start with this. No, you don’t have the predefined gl_FragColor. That was removed from core OpenGL 3.1 and above. Unless you’re using compatibility (in which case, your 3.30 shaders should say #version 330 compatibility at the top), you should never use this. Now, back to user-defined fragment shader … Read more

glVertexAttribPointer clarification

Some of the terminology is a bit off: A Vertex Array is just an array (typically a float[]) that contains vertex data. It doesn’t need to be bound to anything. Not to be confused with a Vertex Array Object or VAO, which I will go over later A Buffer Object, commonly referred to as a … Read more

Confusion between C++ and OpenGL matrix order (row-major vs column-major)

matrix notation used in opengl documentation does not describe in-memory layout for OpenGL matrices If think it’ll be easier if you drop/forget about the entire “row/column-major” thing. That’s because in addition to row/column major, the programmer can also decide how he would want to lay out the matrix in the memory (whether adjacent elements form … Read more

OpenGL ES versus OpenGL [closed]

Two of the more significant differences between OpenGL ES and OpenGL are the removal of the glBegin … glEnd calling semantics for primitive rendering (in favor of vertex arrays) and the introduction of fixed-point data types for vertex coordinates and attributes to better support the computational abilities of embedded processors, which often lack an FPU … Read more

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 … Read more

Do conditional statements slow down shaders?

What is it about shaders that even potentially makes if statements performance problems? It has to do with how shaders get executed and where GPUs get their massive computing performance from. Separate shader invocations are usually executed in parallel, executing the same instructions at the same time. They’re simply executing them on different sets of … Read more

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