Thursday, December 15, 2011

OpenGL is Easy



Insofar as GUIs are concerned, you're going to have to trust me on this: OpenGL is easy. Sure, building an SSAO, displacement mapped, deferred rendering shader with bloom, glow, volumetric fog inifite texturing and HDR is not easy. But thats for games.

Making some boxes and text move smoothly on screen is, at least as far as graphics technology is concerned, easy. Yet, so many people faced with OpenGL for the first time panic. I constantly get questions about sourcing or building graphics libraries that remove the need for programmers to learn OpenGL.

Experience shows that 2-3 weeks is sufficient for any competent programmer to learn enough OpenGL to build competent GUIs on STBs or TVs. Alternatively we can spend 3 months developing a graphics lib or 2-3 weeks learning to use a third party library. In the latter case, you may think productivity is higher - after all , its a higher level language, but the day your boss enters the room and asks for s feature your graphic library does not support is the day you throw it all away and switch to OpenGL.

With OpenGL ES 2.0 you need the following:
  1. A way to open and close a surface or window, usually not a matter for OpenGL in any case.
  2. A way to animate things smoothly using a real time clock and some animation library. Real time clocks are platform dependent and provided by the OS. Smooth animation ? Start by normalising the input value then use SIN(value) or as a colleague recently used sin(sin(sin(value))).
  3. A maths library. Well the basic maths for a UI is addition for translation, multiplication for scaling, and rotating around x,y and z axes maths can be found anywhere on the net but devolves to cos and sin in each case.
  4. Ability to read textures/images. OK I'll admit, here a library is easier but normally your environment comes with this capability and if not try looking up stb.c and stb.h for a very easy to use, self contained piece of source
You do not need a specialist graphics library.
You do not need to be an expert in graphics.
You do not have to be a mathematician.

Any competent programmer will be writing UIs in OpenGL in less than 3 weeks. You'll have to trust me on this.

Alternatively, you can always just hire me :-).



No comments:

Post a Comment