mirror of
https://github.com/bloeys/nmage.git
synced 2025-12-29 13:28:20 +00:00
x8 MSAA
This commit is contained in:
@ -142,6 +142,9 @@ func initSDL() error {
|
|||||||
sdl.GLSetAttribute(sdl.GL_DEPTH_SIZE, 24)
|
sdl.GLSetAttribute(sdl.GL_DEPTH_SIZE, 24)
|
||||||
sdl.GLSetAttribute(sdl.GL_STENCIL_SIZE, 8)
|
sdl.GLSetAttribute(sdl.GL_STENCIL_SIZE, 8)
|
||||||
|
|
||||||
|
// Allow us to do MSAA
|
||||||
|
sdl.GLSetAttribute(sdl.GL_MULTISAMPLEBUFFERS, 8)
|
||||||
|
|
||||||
sdl.GLSetAttribute(sdl.GL_CONTEXT_PROFILE_MASK, sdl.GL_CONTEXT_PROFILE_CORE)
|
sdl.GLSetAttribute(sdl.GL_CONTEXT_PROFILE_MASK, sdl.GL_CONTEXT_PROFILE_CORE)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
@ -198,6 +201,7 @@ func initOpenGL() error {
|
|||||||
gl.FrontFace(gl.CCW)
|
gl.FrontFace(gl.CCW)
|
||||||
|
|
||||||
gl.Enable(gl.BLEND)
|
gl.Enable(gl.BLEND)
|
||||||
|
gl.Enable(gl.MULTISAMPLE)
|
||||||
gl.Enable(gl.FRAMEBUFFER_SRGB)
|
gl.Enable(gl.FRAMEBUFFER_SRGB)
|
||||||
gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
|
gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
|
||||||
|
|
||||||
@ -223,3 +227,12 @@ func SetVSync(enabled bool) {
|
|||||||
sdl.GLSetSwapInterval(0)
|
sdl.GLSetSwapInterval(0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func SetMSAA(isEnabled bool) {
|
||||||
|
|
||||||
|
if isEnabled {
|
||||||
|
gl.Enable(gl.MULTISAMPLE)
|
||||||
|
} else {
|
||||||
|
gl.Disable(gl.MULTISAMPLE)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user