Sign in to follow this  

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

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

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