What is so bad about GL_QUADS?

The point is that your GPU renders triangles, not quads. And it is pretty much trivial to construct a rectangle from two triangles, so the API doesn’t really need to be burdened with the ability to render quads natively. OpenGL is going through a major trimming process, cutting a lot of functionality that made sense … Read more

OpenGL VAO best practices

VAOs act similarly to VBOs and textures with regard to how they are bound. Having a single VAO bound for the entire length of your program will yield no performance benefits because you might as well just be rendering without VAOs at all. In fact it may be slower depending on how the implementation intercepts … Read more

OpenGL vs. OpenCL, which to choose and why?

OpenCL is created specifically for computing. When you do scientific computing using OpenGL you always have to think about how to map your computing problem to the graphics context (i.e. talk in terms of textures and geometric primitives like triangles etc.) in order to get your computation going. In OpenCL you just formulate you computation … Read more

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

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

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)