Jump to content
  • Advertisement
Sign in to follow this  
execubot

Transparent sphere

This topic is 3841 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
Advertisement
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
You could draw two spheres and the second one is larger than the first one by a small amount and blend it with a lighter transparency factor and a bit less blue???

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!