[Interest] OpenGL under Android... glMatrixMode(GL_PROJECTION) was not declared in this scope

Till Oliver Knoll till.oliver.knoll at gmail.com
Wed Dec 4 19:19:23 CET 2013

(On Topic again)

Am 04.12.2013 um 17:53 schrieb Sean Harmer <sean.harmer at kdab.com>:

>  It does however mean learning about buffer objects 
> (vertex buffer objects (VBOs) and maybe index buffers (IBOs)) as well as 
> shaders.

And to make things slightly more confusing (at least for me when I touched that shady shader language): since its introduction of the GLSL it had its own versioning. So when you talked e.g. about OpenGL 3.1 you were then referring to GLSL 1.5 (or whatever - numbers might be wrong here and are for illustration purposes only -> Wikipedia gives a nice overview).

Only since OpenGL 3.2 (or 3.3) was the GLSL version "in sync" with the OpenGL API version.

Needless to say that the GLSL syntax changed noticeably somewhere in between, especially when it comes to "input/output" parameter declaration. I think most (if not all) Qt OpenGL examples use the "older" (outdated?) syntax (GLSL 1.5?), but that might simply be such that the shaders work on both (desktop) OpenGL and OpenGL ES 2. Because what I said mainly refers to the *desktop* OpenGL version ;)

Best thing: buy a recent OpenGL 4.x book (which usually also shows the changes done to previous GLSL versions, and usually also the differences to OpenGL ES). 



P.S. Qt 5 has more and more "helper classes" which implement lots of GL "boiler plate" code which lets you create a GL context, compile GLSL shaders (including binding parameters with a Qt style API) etc. - some/most of those Qt classes even work on both OpenGL/ES - but it is still useful to understand how a "shader program" works on how "vertex data" gets transfered from RAM to VRAM (keyword: "vertex buffers").

By the way: if you find glVertex ("immediate mode") or glMatrixMult calls and the sort in any GL example/tutorial code: ignore it! That's definitively not the way anymore! The way to go are GLSL shaders which manipulate vertex data and "fragments" ("colour") etc., "buffer objects" and yes, OpenGL API deprecated all matrix operations such as multiplication, translation etc.. Coincidentally Qt offers nice matrix classes since several versions ;)

More information about the Interest mailing list