Graphics Reference
In-Depth Information
built-in atribute and uniform variables of GLSL 1.10, but requires you to cre-
ate your own variables as needed. This is similar to GLSL 3.30, and in fact
GLSL 4.10 is a proper superset of the OpenGL ES shader language 1.10—if you
write a shader program in OpenGL ES, it will run with OpenGL 4.1.
How Can You Respond to These Changes?
There are two ways you can respond to the continuing evolution of the
OpenGL shader standards.
1. Follow the standards and make continuing changes to your code to use
the latest versions. Do everything the core profile requires. At the top of
your shader sources, put the line
#version 4.00 core
The advantages of using the latest shader standards are performance
and generality, and by using the right subset of the core profile you can
be compatible with OpenGL ES 2.0. The disadvantage is that the latest
graphics hardware is needed to use these standards and you must com-
mit to continuing code maintenance to keep current as the standards
evolve.
2. Adopt as much of the evolving standards as you want, to take advantage
of ways the changes provide more performance without making your life
too difficult, and use compatibility mode for the capabilities you want to
keep from earlier standards. At the top of your shader sources, put the
line
#version 4.00 compatibility
This will let you use whatever you like from any earlier version of the
standard.
For example, you may want to target an audience that could not
be expected to have the latest graphics hardware. Or perhaps you may
want to simplify your shaders by using built-in atribute or uniform vari-
able names from OpenGL 2.1, but may want to use tessellation shaders,
or perhaps vertex buffer objects because they are much more efficient
than begin-end primitive definition and they can be disguised to look
like begin-end.
Your code will run at least as fast on the newer cards as it did on
older ones, it may be easier to get people productive with the earlier ver-
sions, and you will not have to rework your existing code.
Search WWH ::




Custom Search