this post was submitted on 17 Oct 2023
1 points (66.7% liked)

C++

1805 readers
2 users here now

The center for all discussion and news regarding C++.

Rules

founded 2 years ago
MODERATORS
 

I was trying to replicate an example of the last example of this section of this opengl tutorial, but without the textures, with wireframe cubes and with all the cubes rotating but when i run it only 1 cube is rendered.

I tried to do it again from scratch but only with c style code (except by the shaders and the glfw window) and i got the same result. Why it only renders 1 cube?

vertex shader: https://pastebin.com/6VzJKwBN fragment shader: https://pastebin.com/Ns9dLmqe the source file: https://pastebin.com/MvQtQG3g canned_glfw_window.hpp: https://pastebin.com/h2zD1WbK canned_glfw_window.cpp: https://pastebin.com/N2WX7NT8

you are viewing a single comment's thread
view the rest of the comments
[–] graphicsguy 2 points 1 year ago

Launch your .exe from renderdoc and take a gpu capture. From there you should be able to see:

  • Did it actually dispatch more than 1 draw call? If not, then there's a problem in your source file not dispatching all your draws
  • If it dispatched multiple draws, inspect the VS output. Did they all just project offscreen or to a singular point or to the exact same points so they're all on top of each other? If so you have an error in your VS shader or your constants
  • If the VS output is correct, then the problem lies in your pixel shader or output merger. Pixel shader might be 0'ing out your pixels, blend state might be alpha-0, write mask might be turned off, a whole bunch of possibilities.

Renderdoc is your best friend for these bugs