This commit is contained in:
bloeys
2023-10-07 11:28:59 +04:00
parent caa76c2a5e
commit d703a5270c
2 changed files with 15 additions and 0 deletions

View File

@ -142,6 +142,9 @@ func initSDL() error {
sdl.GLSetAttribute(sdl.GL_DEPTH_SIZE, 24)
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)
return nil
@ -198,6 +201,7 @@ func initOpenGL() error {
gl.FrontFace(gl.CCW)
gl.Enable(gl.BLEND)
gl.Enable(gl.MULTISAMPLE)
gl.Enable(gl.FRAMEBUFFER_SRGB)
gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
@ -223,3 +227,12 @@ func SetVSync(enabled bool) {
sdl.GLSetSwapInterval(0)
}
}
func SetMSAA(isEnabled bool) {
if isEnabled {
gl.Enable(gl.MULTISAMPLE)
} else {
gl.Disable(gl.MULTISAMPLE)
}
}

View File

@ -141,7 +141,9 @@ func main() {
}
defer window.Destroy()
engine.SetMSAA(true)
engine.SetVSync(false)
engine.SetSrgbFramebuffer(true)
game := &OurGame{
Win: window,