GL_POLYGON_SMOOTH for Direct3d ?

Started by
4 comments, last by legalize 15 years, 4 months ago
What is the equivalent of OpenGL's GL_POLYGON_SMOOTH/GL_LINE_SMOOTH (drawing of a primitive with antialiased edges) for Direct3D ?
Advertisement

call IDirect3DDevice9::SetRenderState method and set D3DRS_MULTISAMPLEANTIALIAS to TRUE

however you still need to set up the device for anti aliasing. see this page here:

http://msdn.microsoft.com/en-us/library/bb173422(VS.85).aspx


I believe GL_POLYGON_SMOOTH applies to an old method of anti-aliasing that's no longer used on modern GPU's. These days multisampling is the preferred method of anti-aliasing. To enable multisampling, you have to create your backbuffer or render target with an appropriate multisample mode (2x, 4x). How this is done depends on the exact Direct3D API you're using (native D3D9, native D3D10, D3D9 through SlimDX, D3D10 through SlimDX, XNA Framework).
Thank you for your responses but I'm already aware of the multisampling option.
The difference with GL_POLYGON_SMOOTH/GL_LINE_SMOOTH is that only the edges in a specific drawing call are antialiased, not the whole render target.

One helpful fella (who must've deleted his reply for some reason, cause it's gone now) pointed me to this link which seems to be Direct3D's version but only for lines :

http://msdn.microsoft.com/en-us/library/bb174699(VS.85).aspx
Like neomech mentioned you can set the renderstate to enable it or disable it for any particular draw call.
OpenGL has some state that is per-edge and not per-primitive. Direct3D render states can be divided down by primitives. If you want per-edge rendering differences, then you can emulate that with a shader and appropriate constant data.

My free book on Direct3D: "The Direct3D Graphics Pipeline"
My blog on programming, vintage computing, music, politics, etc.: Legalize Adulthood!

This topic is closed to new replies.

Advertisement