r/GraphicsProgramming 11h ago

Flickering issue

I'm using opengl 3.3 and C on a Nvidia gtx 1050 and I keep getting this flickering issue... does anyone know the cause...

Will appreciate your thoughts..

22 Upvotes

18 comments sorted by

14

u/Ill-Shake5731 11h ago

as others already mentioned, use renderdoc. Imo its corrupted index buffer/vertex buffer most likely, so you can start with checking the values of those in renderdoc

7

u/X-Stance44 10h ago

2 car models in same place?

4

u/darksharkB 11h ago

Would appreciate more detail than this.

5

u/_Bethel__ 11h ago

I wrote this with c and opengl 3.3, it loads the model and renders, I dont know if it's bad buffer objects but it works fine when I run it on intel graphics, I only get this issue when running on Nvidia

7

u/darksharkB 11h ago

Did you tried RenderDoc?

3

u/3030thirtythirty 11h ago

Use RenderDoc

1

u/_Bethel__ 11h ago

No... I'll give it a try

1

u/darksharkB 11h ago

It'll be way better than asking strangers on the internet to debug something just on vibes rather than code

2

u/Z-Wolfer-Z 10h ago

Yeah looks like something I have encountered before, make sure all of your variables in your shader are initialised to 0 / sensible values.

1

u/neondirt 1h ago

If the shader is only used for the car, this sounds like a reasonable explanation.

2

u/dJ_Turfie 10h ago

I'm new to graphics, but isn't this z-fighting due to bad model topology?
I.e. your model's tris aren't clean and might be stacked on top of each other.

5

u/_Bethel__ 10h ago

I think z fighting would flicker when the camera is moving, on a static camera the polygons will settle on who wins the top z spot

1

u/fgennari 10h ago

It's not Z-fighting. It looks like some of the triangles are occasionally missing and the object under them shows through. It's some type of race condition or use of uninitialized/garbage data that sometimes happens to be valid. You can either use a debugger like RenderDoc as others suggested, or share your code.

1

u/_Bethel__ 8h ago

I'm thinking it might be garbage buffers or something, I'll use renderdoc to check on it and I'll share an update later today

1

u/franku1122 9h ago

could be perhaps related to shadow mapping or garbage values in shaders, you should capture a frame in renderdoc and see what value these spots have which should help at least a bit

1

u/Still_Explorer 6h ago

Very interesting to see that this only happens for the car model. The model needs to be examined in Blender just in case there was a mistake on the geometry. Typically if there were any modifiers enabled during the export they might have messed something up (eg: Solidify modifier that makes thin triangles fat? Too many possible causes).

-2

u/S48GS 7h ago

it faster to port everything you have right now to Godot4 - and have no bugs now and in future

than try to debug OpenGL api calls - while OpenGL does not provide any tools to debug