Jump to content
  • Advertisement
Sign in to follow this  
sofakng

How can I create glowing 2D lines/polygons like Defcon/Project Vex?

This topic is 4177 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

I'm trying to create a very simple 2D game that uses retro vector graphics like in the games Defcon and Project Vex. The effect I'm trying to get is glowing lines and the transparent color inside of a color. See the screenshots here: http://devimg.net/?Post=448 http://www.introversion.co.uk/defcon/about/screenshots.html Apparantly the Project Vex game is doing it by applying a bloom effect to the whole screen but I haven't the slightest idea on how to do this... (I can barely create textured quads and display them!) However, my game will be very simple so I don't really need to understand how shaders work, etc, etc... all I really what is a simple way to display glowing/transparent lines/polygons. :) Can anybody help me out or point me in the right direction? Thanks, John

Share this post


Link to post
Share on other sites
Advertisement
Well, a simple method would be drawing a line, and then drawing a larger but more transparent line over that. You could repeat this multiple times to get a smooth transition.

The function for setting the line width is:


void glLineWidth(
GLfloat width
);




You'll also need to use blending, which goes like this:
(I'm sorry if you already know this stuff, I'll just write it down incase you dont :P)



glEnable(GL_BLEND); //Enable blending
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); //Set the blend func

glColor4f(red, green, blue, alpha); //Alpha is from 0.0 - 1.0



Share this post


Link to post
Share on other sites
Thank you VERY MUCH for the detailed example!

I've never tried that technique but it seems like it wouldn't be quite as good as bloom shader or something like that. Is that true?

Also, can I still use anti-aliasing with that effect?

Thanks!

- John

Share this post


Link to post
Share on other sites
Hehe, no problem :)

This technique isn't as good as the real thing ofcourse, but I guess it's as close as you get to it.
And yes, antialiasing will work. ;)

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!