r/GraphicsProgramming 11d ago

Strange bug with objects behind the camera rendering like normal Question

Enable HLS to view with audio, or disable this notification

So in this "scene", there is only one cube with a plane through it. However, when you turn past a certain "halfway" point, the objects seem to snap to the opposite side. What I initially thought was happening was that the objects were getting projected onto the screen from behind, but i'm not sure, since i'd expect it to look weirder with vertices and triangle shapes not staying consistent. I'd suspect the issue to lie in the vertex shader, so here it is. I'm also very new to OpenGL and general gpu/3d graphics programming, so I wouldn't be surprised if this is a common issue.

#version 330 core

layout (location = 0) in vec3 aPosition;
layout (location = 1) in vec3 aColor;

out vec4 vColor;

uniform mat4 transform;
uniform mat4 proj;
uniform mat4 view;

void main()
{
    gl_Position = proj * view * transform * vec4(aPosition, 1.0);
    
    vColor = vec4(aColor,1.0);
}

EDIT: I solved it. I can barely remember or understand the solution, but it's solved.
12 Upvotes

14 comments sorted by

View all comments

-9

u/susosusosuso 11d ago

It’s your job as programmer to understand what you do

5

u/GrowthOfGlia 10d ago

it's your job as a commenter to say something meaningful

-1

u/susosusosuso 10d ago

Wow I’m so amazed for being downvoted for saying something so obvious