Using OpenGL GLSL 3.3 in a 2.1 context

I have an old Nvidia card (Go GeForce 7400) which I know supports only OpenGL 2.1. Even if I force GLFW to create a 3.3 context on this machine, the program is guaranteed to crash or returns a NULL window. However, I found the machine can actually run some simple shaders written in GLSL version 3.3 under a 2.1 context. They even have #version 330 core version declarations. To my suprise, the program did not complain while compiling these shaders and everything seems to work.

So here is what I did:

  • Create a context using GLFW and specifically passed 2.1 as version number.
  • Load and compile shaders written in GLSL 3.3, and everything works like magic.
  • To my understanding, GLSL 3.3 comes only with OpenGL 3.3+. And before that, the GLSL version for OpenGL 2.1 is actually 1.20. So can anyone tell me what happened? Is this because my graphic card's driver has ``secretly'' implemented GLSL 3.3 but supports only OpenGL 2.1 APIs? What is the chance to find this kind of weird combination to work in general? I'm pretty sure I shouldn't assume GLSL 3.3 to work in a 2.1 context in genral, should I?

    BTW I think I am using Linux Nvidia proprietary driver for the card.

    链接地址: http://www.djcxy.com/p/38522.html

    上一篇: Linux上的OpenGL与Mesa 12.0.3不支持GLSL 3.30

    下一篇: 在2.1上下文中使用OpenGL GLSL 3.3