Thursday, February 9, 2017

Learning OpenGL

A while ago I started to play with OpenGL and OpenGL shaders again. I thought that it would be nice to write down some good tips about good sources and tools for your learning process. I think that learning OpenGl 4 (the latest major version at time of writing) is more useful to learn than earlier versions because when you are done learning OpenGL 4 basics it is probably what most hardware will support.

If you have no knowledge at all about OpenGL I think this is a good starting point: Render hell. It is probably the best (and the most fun) overview you can find for a render beginner.

After reading that short but colorful introduction you should buy your self these OpenGL books:

The first two are about OpenGL 4 and how to use OpenGL in broad terms and are the de facto standard reference literature in the subject and the last one is handy OpenGL Shading Language cookbook. There are plenty of tutorials also available on the internet if you do not want to buy the books above. However, the books above will probably take you further than any online tutorial.

To learn OpenGl yo need to code. Most of what you need is covered in the books above or in many of the online tutorials you can find. However if you are mostly interested in programming in the OpenGL shading language then there are two tools that can be of interest: Shadertoy and ShaderTool.

During my play I have found a very useful sandbox called Shadertoy. Shadertoy is a webpage where you can write WebGL pixel/fragment shader code and see the result directly so it is a perfect tool for learning and play around with pixel (fragment) shader code. WebGL is based o OpenGL ES 2.0 and OpenGL ES is a subset of OpenGL. It is pure joy! So go there and have fun:

ShaderTool is a desktop application only available for Windows at the time of this writing (will be available for Windows, Mac and Linux in the future). It supports writing Vertex, Control (Hull), Evaluation (Domain), Geometry and Pixel shaders. So ShaderTool is much more powerful tool than Shadertoy, but it costs money. Here is a list of some features ripped directly from the developer:

  • Write shaders and view results instantly
  • Support of HLSL and GLSL (DirectX and OpenGL)
  • Latest shader models fully supported
  • Code editor with syntax highlighting, warning and error output
  • Easy-to-use node-based render pipeline
  • Import models, textures, audio files and other resources per drag'n drop
  • Export your shaders and share them with others
  • Create template projects for more efficient shader development
  • Direct use of shaders in DirectX or OpenGL applications
  • Oculus Rift DK 2 fully supported (Direct Acces Mode)
  • Use audio streams for shader input to create stunning effects
  • Post-Effects fully supported
  • Create multiple render-pipelines and combine them to create AAA shaders used in games

No comments:

Post a Comment