Hot answers tagged

5

It's a bit complicated because the actual wait for vsync does not happen on the CPU, it happens on the GPU. The GPU wait then creates back-pressure that propagates back to the queue of submitted command lists on the CPU, through the GL driver, and eventually to your app. The exact behavior will depend on the details of how the GPU vendor chose to implement ...


4

This is a similar question to following: When do you need to cook? You can go to a restaurant. Why would you need to know woodworking? You can buy things from a shop. There are two answers here In order for you to claim ownership on some tech. You need to build it. This can be simply because you have chosen to sell a competing product or need to lower your ...


3

This question and its answer, actually answer my question. I had to read its answer carefully and find my mistake. Now my fragment shader look like this: const GLchar* fragmentSource = R"glsl( #version 330 core in vec2 TexCoord; uniform sampler2D ourTexture; #define PI 3.141592653589793238462f #define TWO_PI 6....


2

OpenGL 4.1's glGetProgramBinary and glProgramBinary exist for this purpose. The first one retrieves a binary that represents the compiled program in its entirety (though none of the state stored within it. It, and its implementation-defined format, can be stored and reloaded via glProgramBinary. Of course, there are limitations. Implementations are not ...


1

A fragment shader receives the gl_FrontFacing system-defined input value. It will be false if the fragment was generated from a back-facing triangle, and true otherwise. So you can use that in your shader to determine how to generate a color value.


1

The eye position (a vec3) was being bound to the wrong shader, resulting in the glUniform3 error when OpenGL (mesa) checked the validity of the uniforms. The error was due to a typo; I named my simple-mesh and animated-mesh shaders similar things. glUseProgram(smesh_shader.get()); smb.predraw(); glUniform3fv(mesh_shader.uniform("eye"), 1, &...


1

Older Opengl Api documentation can be found at this Official Khronos Registry


1

Yes, it is guaranteed by the GLSL language specifications (click me). Section "4.1.10. Implicit Conversions" says In some situations, an expression and its type will be implicitly converted to a different type. The spec shows all possible implicit conversions inside a table, also int -> float. It further says: When an implicit conversion is done, it ...


Only top voted, non community-wiki answers of a minimum length are eligible