Tag Info

Hot answers tagged

3

It looks like you're applying way too much noise. You want to multiply the noise value by a small factor so it has a very small amplitude, corresponding to just a few pixels of distortion. Right now you're distorting it so much that every pixel is being sent to a completely different location in the texture, just making a hash of the whole thing. Also, ...


2

By default the output variable (outputColor) is bound to location 0. For a fragment shader this specifies the color value to be used for that fragment for the framebuffer object in position 0. You can bind the output variable to different locations in the application code using glBindFragDataLocation() or in the shader like this layout(location = 0) out ...


2

You're multiplying your vertex position and normal by the view matrix, change it to only use the model matrix. vec4 pos4 = model * vec4(vertex_position, 1.0); Change the normal_matrix to just be the inverse transpose of the model matrix only. glm::mat4 normal_matrix = glm::transpose(glm::inverse(modelMatrix));


2

I've had the same problem several times and haven't found a way to specify a default color that would be used when a texture is not used. I've ended up creating 1x1 pixel fully white, black and transparent textures that are globally available. This does the job pretty well and is easy to use, although I don't like the unnecessary texture accesses in the ...


1

Shouldn´t this already do it? Assuming vUv to cover the whole 0-1 range for each tile. The fract() will make it wrap and then it is scaled and moved to actually fit your tile. uniform float time void main() { float texId = textureId/32.0; vec2 tileOffset = vec2(fract(texId)*32.0,floor(texId)); vec2 offset = invTileCount * tileOffset; vec2 texCord = ...


1

Try setting the texture's minification filter to GL_NEAREST or GL_LINEAR after glTexImage2D(): glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); The OpenGL default is to use mipmaps and you didn't send any which makes the texture incomplete and will disable that texture ...



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