GLSL, Qt, and OpenCL

>> Monday, February 20, 2012

I've coded vertex and fragment shaders in GLSL, but I've never worked with the new geometry and tessellation shaders. To make up for this, I've been reading the OpenGL 4.0 Shading Language Cookbook by David Wolff. It's well written and I'm learning a lot. It's more than just a book of recipes; Dr. Wolff does a fine job explaining the underlying concepts.

One aspect of the book I find particularly interesting is the use of Qt in the example code. This is the first OpenGL/GLSL book I've seen that relies on Qt instead of GLUT, and I strongly approve. I have nothing against GLUT, but it was created as a quick-and-dirty way to demonstrate OpenGL coding. There are efforts to build on top of GLUT (see GLOW), but it's still not a professional toolset for building full-featured applications. In contrast, Qt provides a wealth of features including a new method of multithreading that improves the performance of OpenGL rendering. Unfortunately, because so much OpenGL code relies on GLUT, many conflate the two and assume GLUT's limitations apply to OpenGL.

Another thought struck me as I read Dr. Wolff's book. GLSL shaders and OpenCL kernels have a lot in common: similar purposes, operations, and datatypes. But the APIs are so different that you'd never guess they were released by the same group. For OpenCL 2.0, it would be helpful if the kernel API was changed to resemble GLSL. This would make it easier to code GPU drivers and compilers and would probably increase the developer base of both languages. Besides, in my OpenCL-OpenGL applications, the OpenCL kernels act like pre-shaders, manipulating vertices and colors before the real shaders begin processing.


Post a Comment

  © Blogger template Werd by 2009

Back to TOP