Skip to main content
gamedev.net
🔒 Locked

Dynamic Transparency

Started by DarkYoda42 2 replies 1.3k views
Original Post
DarkYoda42
DarkYoda42
Hi, had a quick question and was hoping someone could help me out here. What I''d like to do is I have a texture for an object and would like it to become increasingly transparent as it''s "life" timer ticks down. If i use glColor to color it I can easily reset the alpha values every frame and do it that way, however i WOULD like to do it with my texture. Using glColor obviously doesn''t work since it doesn''t change the texture alpha value and i would prefer not to have multiple textures that only varied on the alpha level. Any suggestions? Thanks in advance.
Gammastrahler
Gammastrahler
if you have a copy of your texture image in system memory, you can alter its alpha values directly and then update the texture by uploading the new pixels with glTexSubImagexxD.
DarkYoda42
DarkYoda42
ok, thanks I''ll give that a shot. hafta look up what glTexSubImage does first though.
Mathematix
Mathematix
quote:
Original post by DarkYoda42
Hi, had a quick question and was hoping someone could help me out here. What I''d like to do is I have a texture for an object and would like it to become increasingly transparent as it''s "life" timer ticks down. If i use glColor to color it I can easily reset the alpha values every frame and do it that way, however i WOULD like to do it with my texture. Using glColor obviously doesn''t work since it doesn''t change the texture alpha value and i would prefer not to have multiple textures that only varied on the alpha level. Any suggestions? Thanks in advance.


This is one of the effects that I am pulling off in my game. It''s very straightforward if you ensure that your function is used once per rendering. If you used glColor4f(1.0, 1.0, 1.0, transpVal), where transpVal decrements by some very small value, you will see the effect on-screen.



Regards,
Mathematix.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.