I had been on a trip for a while, and I worked on my opengl project on my laptop while I was gone. When I got back a couple days ago, I decided to start working on it again, but this time on my main desktop pc. However, after I pulled the changes from github and compiled it, the textures seem to be warping around, and the lighting is very dim.
It seems to fix the issue if I remove the check in the vertex shader for whether or not you’re drawing a framebuffer object or not, but that simply draws the FBO as a regular model, with matrices applied and everything.
How it should look (laptop)
How it looks on my desktop
here is the content to the vertex shader:
#version 330 core
layout (location = 0) in vec3 position;
layout (location = 1) in vec3 normal;
layout (location = 2) in vec2 texCoord;
uniform bool frame = false;
out vec2 outTexCoord;
uniform bool lightEnabled;
uniform mat4 camMatrix;
uniform mat4 transMatrix;
vec4 snap(vec4 vertex, vec2 resolution) {
vec4 snappedPos = vertex;
snappedPos.xyz = vertex.xyz / vertex.w;
snappedPos.xy = floor(resolution * snappedPos.xy) / resolution;
snappedPos.xyz *= vertex.w;
return snappedPos;
}
void main() {
if(!frame) {
if(lightEnabled) {
[lighting calculation]
}
gl_Position = camMatrix * transMatrix * vec4(position, 1.0);
gl_Position = snap(gl_Position, vec2(128, 96));
outTexCoord = texCoord;
} else {
outTexCoord = texCoord;
gl_Position = vec4(position.x, position.y, 0.0, 1.0);
}
}
I have confirmed that both pcs are on the same git commit, are running the same version of linux & nvidia driver, and other opengl applications still work normally.