forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

merging colours

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
Energy



Joined: 26 Mar 2005
Posts: 133
Location: uk/beds/flitwick

PostPosted: Sun Jun 04, 2006 7:22 am    Post subject: merging colours Reply with quote

Hey all,
I'm using a graphics.h that has some pretty useful functions in, and one of the features is to get a pixel color on the screen. This is perfect for what I need. It returns a value in the type Color...

typedef u32 Color;

Now what I want to do is give each colour a red tint, so tone down Green and Blue and bring up the Red. How would I do this?

Thanks for any help.
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
CyberBill



Joined: 26 Jul 2005
Posts: 86
Location: Redmond, WA

PostPosted: Sun Jun 04, 2006 2:00 pm    Post subject: Reply with quote

You're going about it all the wrong way. Instead of manually getting each pixel, manipulating its values, and setting it back, which would be HORRENDOUSLY slow, do this:

Make a quad, color it red, give it an alpha channel of like 40% or whatever, and draw it over your entire screen after your done drawing everything else.

Letting the hardware do it is literally a million times faster.
Back to top
View user's profile Send private message AIM Address MSN Messenger
Energy



Joined: 26 Mar 2005
Posts: 133
Location: uk/beds/flitwick

PostPosted: Sun Jun 04, 2006 6:47 pm    Post subject: Reply with quote

CyberBill wrote:
You're going about it all the wrong way. Instead of manually getting each pixel, manipulating its values, and setting it back, which would be HORRENDOUSLY slow, do this:

Make a quad, color it red, give it an alpha channel of like 40% or whatever, and draw it over your entire screen after your done drawing everything else.

Letting the hardware do it is literally a million times faster.


I guessed this would be the slow way, but until I'm more versed in OpenGL I'm pretty stuffed on how I would do this.

I'm trying to draw an explosion, so far. any alpha values have had to be already in the image. I haven't worked out to change the values on the fly.

My idea for an explosion was to draw a circle that got larger and it was translucent. Any idea for code of what you're suggesting would be great.
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
CyberBill



Joined: 26 Jul 2005
Posts: 86
Location: Redmond, WA

PostPosted: Sun Jun 04, 2006 7:50 pm    Post subject: Reply with quote

It just relies on having both a 'material color' and an alpha blended texture.

The texture is of the explosion with an alpha mask, and then you can just make the textured quad get bigger over the course of 250ms or so, while also reducing the alpha of the material color. (So that the material color goes from 0xFFFFFFFF to 0x00FFFFFF).

I'm not exactly sure how to set it up, but I'm sure theres a sample of it... it'll also take a little bit of fooling around with to get it working right.

Experiment with it long enough and you'll figure it out. :)
Back to top
View user's profile Send private message AIM Address MSN Messenger
Energy



Joined: 26 Mar 2005
Posts: 133
Location: uk/beds/flitwick

PostPosted: Sun Jun 04, 2006 8:56 pm    Post subject: Reply with quote

CyberBill wrote:
It just relies on having both a 'material color' and an alpha blended texture.

The texture is of the explosion with an alpha mask, and then you can just make the textured quad get bigger over the course of 250ms or so, while also reducing the alpha of the material color. (So that the material color goes from 0xFFFFFFFF to 0x00FFFFFF).

I'm not exactly sure how to set it up, but I'm sure theres a sample of it... it'll also take a little bit of fooling around with to get it working right.

Experiment with it long enough and you'll figure it out. :)


K that'll be my challenge for the week :D
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group