Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Draw multiple textures with additive alpha



Oh, yeah duh, brainfart on my part.   Too many APIs to keep in my head all at once these days. ;)

-Ken

On May 16, 2008, at 1:17 PM, Richard Salvatierra wrote:

Is glBlendMode() the same as glBlendFunc()

This was not working. Continues to show the background (semi opaque)

[vid_A bindCurrentTexture]; 
glBlendFunc(GL_ALPHA, GL_ZERO); 
[vid_A compositeChannelInRect:theRect]; 

[vid_B bindCurrentTexture]; 
glBlendFunc(GL_ALPHA, GL_ONE); 
[vid_B compositeChannelInRect:theRect];

-Rich


On May 16, 2008, at 3:44 PM, Kenneth Dyke wrote:


On May 16, 2008, at 12:37 PM, Richard Salvatierra wrote:

I am drawing multiple textures during a transition from one image to another (slide show) 

// FIRST image with opacity = .4

glBlendMode(GL_SRC_ALPHA, GL_ZERO);

glColor4f(1.0f, 1.0f, 1.0f, opacity);
glBegin(GL_QUADS);            
glTexCoord2f(...);
glVertex2f  (...); etc.
...


glBlendMode(GL_SRC_ALPHA, GL_ONE);

// SECOND image with opacity = .6
glColor4f(1.0f, 1.0f, 1.0f, opacity);
glBegin(GL_QUADS);            
glTexCoord2f(...);
glVertex2f  (...); etc.

Try adding those modes.  The first will ensure that the background is effectively removed by the fist pass, leaving only .4 of the first image.     The second pass will then add .6 of the second plus the .4 from the first image, leaving you with an opaque blend of the two without any background.

-Ken

Kenneth Dyke, email@hidden (personal), email@hidden (work)
     Sr Engineer, Graphics and Imaging Team, Apple Computer, Inc.
   Java: The simple elegance of C++ combined with the blazing speed of SmallTalk.




_______________________________________________
Do not post admin requests to the list. They will be ignored.
Mac-opengl mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/mac-opengl/email@hidden

This email sent to email@hidden

Kenneth Dyke, email@hidden (personal), email@hidden (work)
     Sr Engineer, Graphics and Imaging Team, Apple Computer, Inc.
   Java: The simple elegance of C++ combined with the blazing speed of SmallTalk.



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Mac-opengl mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/mac-opengl/email@hidden

This email sent to email@hidden

References: 
 >Draw multiple textures with additive alpha (From: Richard Salvatierra <email@hidden>)
 >Re: Draw multiple textures with additive alpha (From: Kenneth Dyke <email@hidden>)
 >Re: Draw multiple textures with additive alpha (From: Richard Salvatierra <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.