Jump to content
  • Advertisement
redTree

OpenGL OpenGL: How to apply antialiasing in certain area of the screen

Recommended Posts

Hi guys,

I want to apply antialiasing in certain area of the screen using OpenGL.
For instance, if I have a star-shaped mask, I want to apply only to that star-area.
Any ideas?

Thanks!

Share this post


Link to post
Share on other sites
Advertisement

Is this for a special effect or are you trying to gain performance? In the latter case, it is likely not worth the hassle, as changing the relevant render states is relatively slow and you might better off just antialiasing everything. This depends on the target system bottlenecks, though.

If you want to generally mask some rendering by using arbitrary shapes, read up on stencil buffers. Using them, you would draw the star shape to the stencil buffer (to form the mask), and then setting the render states for the subsequent rendering to either pass or reject pixels based on the stencil. In this case, you'd do the antialiased rendering with the stencil configuration that would pass only the pixels within the mask. It is also possible to have more than one bit of stencil data per pixel, for multi-layered pass/reject logics.

If I remember correctly, you can control antialiasing during a frame by using glEnable, glDisable and GL_MULTISAMPLE. Enabling it requires that you have a rendering context that supports antialiasing to begin with.

Share this post


Link to post
Share on other sites

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

  • 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!