Pro OpenGL ES for iOS by Mike Smithwick
Author:Mike Smithwick
Language: eng
Format: epub, pdf
Publisher: Apress®
Published: 2011-12-11T16:00:00+00:00
static const GLfloat squareColorsRGBA[] =
{
1.0, 0, 0, 1.0,
0, 1.0, 0, 1.0,
0, 0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0,
};
Assign the first color array to the first square (which has been the blue one up until now), and assign the second to the former red square. And don't forget to enable the use of the color array. You should be familiar enough now to know what to do. Also, notice that the arrays are now normalized as a bunch of GLfloats as opposed to the previously used unsigned bytes, so you'll have to tweak the calls to glColorPointer(). The solution is left up to the reader (I've always wanted to say that). With the blending disabled, you should see Figure 6-7 (left), and when enabled using the traditional function for transparency, Figure 6-7 (center) should be the result. What? It isn't? You say it still looks like the first figure? Why would that be?
Look back at the color arrays. Notice how the last value in each row, alpha, is at its maximum of 1.0. Remember that with this blending mode, any of the destination values are multiplied by: (1.0 – source alpha), or rather, 0.0, so that the source color reigns supreme as you saw in a previous example. One solution to seeing some real transparency would be to use the following:
glBlendFunc(GL_ONE, GL_ONE);
This works because it ditches the alpha channel altogether. If you want alpha with the “standard” function, merely change the 1.0 values to something else, such as .5. And the result is Figure 6-7 (right).
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Secrets of the JavaScript Ninja by John Resig & Bear Bibeault(6533)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6414)
Kotlin in Action by Dmitry Jemerov(5064)
Odoo 15 Development Essentials - Fifth Edition by Daniel Reis & Greg Mader(3354)
Odoo 15 Development Essentials by Daniel Reis(2814)
React Native - Building Mobile Apps with JavaScript by Novick Vladimir(2531)
Learning Angular - Second Edition by Christoffer Noring(2358)
Pride and Prejudice by Jane Austen(2350)
Mobile Forensics Cookbook by Igor Mikhaylov(2017)
Computers For Seniors For Dummies by Nancy C. Muir(1996)
Bulletproof Android: Practical Advice for Building Secure Apps (Developer's Library) by Godfrey Nolan(1874)
Android Development with Kotlin by Marcin Moskala & Igor Wojda(1799)
Building Android UIs with Custom Views by Raimon Ràfols Montané(1791)
1936941139 (N) by Bob Rosenthal(1732)
Building Progressive Web Apps: Bringing the Power of Native to the Browser by Ater Tal(1727)
Hands-On Internet of Things with MQTT by Tim Pulver(1707)
Android App Development by Franceschi Hervé J.;(1702)
Ember.js in Action by Joachim Haagen Skeie(1689)
Hands-On Design Patterns with React Native by Mateusz Grzesiukiewicz(1656)
