Yes, your vertex and fragment shader could be the cause of the black screen in GLFW. Here are a few things to check:
Make sure that both shaders compile successfully without any errors or warnings. You can check the compilation status using the glGetShaderiv and glGetProgramiv functions.
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.
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.
Verify that your vertex buffer contains the correct data and that you're using the correct data types and sizes in your glVertexAttribPointer calls.
Make sure that your window has been properly initialized with a valid OpenGL context using glfwCreateWindow and glfwMakeContextCurrent.
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.
Asked: 2022-06-25 11:00:00 +0000
Seen: 7 times
Last updated: Oct 09 '21