Sign in to follow this  

Transparent sphere

This topic is 3654 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi. I need to know how to draw a semi-transparent blue sphere. I also need to give a glow effect to lines to simulate lightning. I would appreciate any help on this. Thanks

Share this post


Link to post
Share on other sites
Hi

Make sure lighting is disabled, and enable blending with


glEnable (GL_BLEND);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_DST_ALPHA); // I think it was like this, check http://msdn2.microsoft.com/en-us/library/ms537046.aspx

glColor4f (0.0f, 0.0f, 1.0f, 0.5f); // blue with 50% opacity

// draw your model

glDisable (GL_BLEND); // reset or something


The other thing is a bit more complicated.. exactly what do you mean?

Here's a "Simple Glow" effect applied on wireframe models: http://developer.download.nvidia.com/SDK/10/opengl/samples.html

Maybe that will help you :)

//Johan

Share this post


Link to post
Share on other sites
Thanks for the help, the sphere is working.

I had to comment out GL_DEPTH_TEST and had to use
glBlendFunc (GL_SRC_ALPHA, GL_ONE)
instead of
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_DST_ALPHA);

I'll now have to focus on getting the lighting right to make it look good. As it is now it seems a circle, not a sphere.

The idea is to simulate a plasma ball.
I have two spheres and I generate lines with a random path to simulate the sparks between them.
So I need to apply the glow around the lines to make it look more realistic.

Share this post


Link to post
Share on other sites
Typically for glow, you saved the image of an item to be "glowed" to a texture, blur that texture, and then draw it back over the screen. This will extend that objects color to neighboring pixels and make it appear to emit light.

Share this post


Link to post
Share on other sites

This topic is 3654 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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