Graphics Reference
In-Depth Information
to the new approach. Compare the installed base for OpenGL desktop to
the installed base for OpenGL ES (mobile), and you realize that develop-
ing applications that run only on OpenGL desktop is short-sighted. As the
standard continues to evolve, you will have a huge advantage if you develop
applications that can run both on the desktop and on the ubiquitous mobile
devices.
For our own work, we have developed a way to start a smooth transition
to the new approach through the use of a set of #defines in a file called gstap.h ,
shown here and also available at this topic's website:
#ifndef GSTAP_H
#define GSTAP_H
// gstap.h -- useful for glsl migration
// from:
// Mike Bailey and Steve Cunningham
// “Graphics Shaders: Theory and Practice”,
// Second Edition, AK Peters, 2011.
// we are assuming that the compatibility #version line
// is given in the source file, for example:
// #version 400 compatibility
// for OpenGL-ES compatibility:
precision highp float;
precision highp int;
// uniform variables:
#define uModelViewMatrix gl_ModelViewMatrix
#define uProjectionMatrix gl_ProjectionMatrix
#define uModelViewProjectionMatrix
gl_ModelViewProjectionMatrix
#define uNormalMatrix gl_NormalMatrix
#define uModelViewMatrixInverse gl_ModelViewMatrixInverse
2. “gstap” stands for the topic title, Graphics Shaders: Theory and Practice .
Search WWH ::




Custom Search