Jump to content
  • Advertisement
Sign in to follow this  
BeanDog

OpenGL Software metaballs with memory surfaces [SDL]

This topic is 3851 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 realize that this thread on efficient 2D metaballs is still on the front page of this forum, but it's going into discussions on how to speed the rendering of 2D metaballs using the GPU. I'm interested in finding an efficient way to render them directly onto an SDL surface in software--partially as an academic exercise, and partially to keep my 2D game from requiring any shaders, OpenGL libraries, etc. A while ago, I put together a reasonably quick additive-blit function for SDL. I could go about doing this in conceptually the same manner outlined in the other metaball thread--just additive-blend all the metaball influences together into an off-screen surface, and use it as a stencil with a low cutoff. The problem is that last part--is there a library or function I'm missing that could make that part quick and painless? I know I can set colorkeys easily on blits, but is there a way to do an alpha-tested blit? Or is it time to break out my SIMD-fu again?

Share this post


Link to post
Share on other sites
Advertisement
SDL_BlitSurface doesn't support alpha testing... Though the source code is available so you could just look at how the color key is done and make a version that checks alpha values instead of color. I doubt it would require changing more than a couple of lines of code.

Anyway, what kind of resolution are you thinking about? I did something like this with a naive, unoptimized all-C approach way back in the days of 300MHz Pentium2's and it ran just fine in 640x480 (and still does). On a modern computer, the same code would probably run in any resolution you can find on a desktop since CPU power has increased faster than screen resolutions. The single "alpha tested" blit shouldn't be a bottleneck like the drawing of the metaballs themselves (assuming there's significant overdraw like there usually is).

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!