New answers tagged

2

I am suprised that it was only mentioned in comments but yes you can use variable length arrays through SSBO. Here is the excerpt from wiki: On the host side: int data[SOME_SIZE]; ... GLuint ssbo; glGenBuffers(1, &ssbo); glBindBuffer(GL_SHADER_STORAGE_BUFFER, ssbo); glBufferData(GL_SHADER_STORAGE_BUFFER, sizeof(data), data‚Äč, GLenum usage); //sizeof(data) ...


1

Assuming that alpha works properly in the rest of the code it can be solved on shader level: out vec4 color; in vec2 uv; uniform sampler2D tex; void main() { color = texture(tex, uv); color.a = 0.0; if (all(greaterThan(uv, vec2(0.0))) && all(lessThan(uv, vec2(1.0)))) { color.a = 1.0; } }


0

I exported an example from Blender to replicate the issue, with the most basic project (unwrap, simple image texture in shader editor) and found it looked exactly like what your expected image shows. I exported it to some simple model-loading code and it textured it correctly. When I used your OBJ file (after adding mtllib cube.mtl and a map_Kd cube.png to ...


1

Fellow 15-year-old here. As far as I have read, you would usually implement an Area light by combining multiple things: A point or directional light at the position for BRDF calculations. Using the size of the light for a specular highlight. PCSS or another technique for soft shadows.


0

I found a workaround suggested at the bottom of this page : to deal with coplanar lines and polygons, one can apply a different glDepthRange to polygon face and polygon wireframe.


2

You could add the variable as code when you upload the shader code. char header[64]; sprintf (header, "const int size = %u;\n", pointLights.size()); Then add the header (assuming your code is in char code[]): GLchar *source[2] = {(GLchar *)header, (GLchar *)code}; glShaderSource(shader, 2, (const GLchar **)source, NULL); .. That way you can ...


Top 50 recent answers are included