Skip to main content
GameDev.net gamedev.net
🔒 Locked

cg shaders: enabled/disable blending?

Started by Daywalker313 Oct 28, 2005 at 5:13 AM 1 replies 700+ views
Original Post
Daywalker313
Daywalker313
Hi there, I want to enabled/disable blending an the blend function with my cg shaders. The problem is, I usually have to change their states inside my code but how should my program know wheter a shader makes a material semi-translucent? I googled a bit and found the CgFX standard, but it seems like it's hard to implement and I'd like to continue with simple cg shaders. Is there any way how I could manage this or is it true that I have to know which shaders will require blending related stuff at compile-time?
zedzeek
zedzeek
i havent used cg but i assume this is not possible cg + glsl dont deal with blending at all
if u want the shader to know if blending is enabled or not u can pass the info as a unifrom
Daywalker313
Daywalker313
Thanks for your reply but this is really bad now.
I could define some keyword that I add as a comment to the shaders and parse the shader file manually to find out wheter the shader requires blending enabled etc.
But it's not clean in any way.
Does someone know how professional games that are using cg/glsl/hlsl shaders handle this issue?

Topic Locked

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

Sign in to reply to this topic.