Sign in to follow this  
ahmadka

Need help on basic transparency and lighting in GLUT...

Recommended Posts

Hi Guys !! This is my first post here, so please help me out people...:D I have recently started learning GLUT, and have been on a mission to create this scene in GLUT....I have gotten about half way though, but now I am facing some serious problems....please hear me out... I am trying to create this image in GLUT: http://img230.imageshack.us/img230/5546/df2id5.jpg Now, I have done some work on it already...like the background gradient (going from white to purple)...I loaded a texture for that...actually I tried to implement it though lighting, but that didnt work for me... Basically, the two major problems I am facing now are these: 1) I dont quite know how to create clouds that are in the bottom half of the picture..... I thought of using clouds 'layers'... Here is the basic idea I thought of: a) I make some cloud textures in photoshop b) I load these textures in GLUT c) I tell GLUT to make the cloud 'layers' transparent, based on the texture color at a specific pixel..If its 100% white, then it should be completely transparent...if its a light blue colour (like in the picture above), then it should be opaque....I dont know how to implement this in GLUT though... 2) The second question I have is this: Can lighting be only used on 3D shapes ? Can't it be used on 2D shapes like GL_QUADS, GL_POLYGON ?? I can get light to fall on 2D shapes like GL_QUADS, etc...but I canNOT get the light to distribute on the *un*evenly...What I mean to say is that, the light just spreads out on the surface of GL_QUADS uniformly eveywhere....whereas it should actually be brighter on areas nearer to the light source (like in real life)... If someone can show me how to use proper lighting on 2D shapes like GL_QUADS, I would be really greatful... Also, here is my project (not finished though): http://rapidshare.com/files/21504891/Undertaker.rar

Share this post


Link to post
Share on other sites
1/ forget option c, in photoshop add an alpha channel to the texture, draw into there where u want the cloud to be shown. save it as a 32bit texture eg tga, dds.
in your app enable blending with GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA

2/ lighting can be used on anything even lines or GL_POINTS the only thing thats required is normals, though with a quad u only have 4 vertices thus the lighting will most likely look crap. better to use a normalmap texture

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this