Nothing drawn when creating a window with minimum OpenGL version?

Started by skoovo, March 21, 2021, 20:57:10

Previous topic - Next topic



Firstly, I am very new to LWJGL so I apologise if this is "obvious", but I didn't find an answer either on or off the forum.

When creating a window using GLFW, I'm trying to set window hints to request a minimum version of OpenGL. For my purposes I requested version 4.3 like so:


After creating a window, I check the OpenGL version with:


It shows that the version is set correctly, but nothing is drawn. The clear colour is applied, but my geometry isn't rendered. I'm using features that require GLSL version 430. If I remove the window hints, it defaults to OpenGL 4.6 and draws perfectly. However, if I then request 4.6 through window hints, nothing is drawn. I am really confused, since it seems to be the process of hinting that is causing me issues.

I've tried several versions and the results are interesting:

Hinted Version   Actual Version   Drawn

I also checked the version of GLFW and it says 3.4.0. Is this a pre-release/beta of the next GLFW version? It seems that 3.3.3 is the current. I'm using Kotlin with gradle and LWJGL version 3.2.3, if that helps.

This could just be a really newbie mistake that I just can't spot, but it seems strange to me that hinting causes OpenGL to not draw. If anyone has come across this before, or can point me in the right direction, I would really appreciate it. Thanks for your time! :)



just by looking at your - quite neat - table of hinted / actual version and drawn relations it looks like you are using some functionality that is deprecated in core profile
just a shot in the dark: maybe you do not bind a vertex array object prior to setting up your vertex attribs / rendering, which in core profile must be bound
during development i can always recommend using a debug callback (have a look at ARBDebugOutput), it will probably tell you what is wrong
there is also a hint for the profile, search for GLFW_OPENGL_PROFILE

greetings from the shire,



Thanks for the quick reply. You were absolutely right about the VAO. Although I *thought* I was creating it and binding it, an incorrect function call meant that I wasn't.  This only showed itself when explicitly requesting an OpenGL version which in turn gave me a CORE profile. The default appears to be a COMPAT profile.

Also, nice tip about the debug output. I looked into ARBDebugOutput, and it told me exactly where I had messed up with the VAO.

Thanks for taking the time to solve my headache. I appreciate it! :)