Ask Your Question
0

Could my vertex and fragment shader be the cause of the black screen in glfw? Any assistance or guidance towards the correct direction would be greatly appreciated.

asked 2022-06-25 11:00:00 +0000

devzero gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2021-10-09 00:00:00 +0000

plato gravatar image

Yes, your vertex and fragment shader could be the cause of the black screen in GLFW. Here are a few things to check:

  1. Make sure that both shaders compile successfully without any errors or warnings. You can check the compilation status using the glGetShaderiv and glGetProgramiv functions.

  2. Ensure that you're setting the correct uniforms and attributes in your shader program. If you're using modern OpenGL, you can use functions like glGetUniformLocation and glVertexAttribPointer to set these values.

  3. Check that your shaders are actually being used by the program. You can do this by calling glUseProgram with the ID of your shader program.

  4. Verify that your vertex buffer contains the correct data and that you're using the correct data types and sizes in your glVertexAttribPointer calls.

  5. Make sure that your window has been properly initialized with a valid OpenGL context using glfwCreateWindow and glfwMakeContextCurrent.

  6. Check if any OpenGL errors are being generated by your code. You can use glGetError to query for errors after each OpenGL function call.

These are just a few things to consider when troubleshooting a black screen in GLFW. It's important to isolate the issue by testing different parts of your code and verifying that each component is functioning correctly.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-06-25 11:00:00 +0000

Seen: 7 times

Last updated: Oct 09 '21