Reputation: 2085
When using Swift to create an OpenGL app I get this error whenever I use OpenGL commands, for example:
glBindRenderbuffer(GL_RENDERBUFFER, self.colorRenderBuffer)
I get an error 'Int32
' is not convertible to 'Glenum
'
Any ideas how to fix this?
Upvotes: 4
Views: 666
Reputation: 43330
Constants like the ones OpenGL uses are imported in Swift as top-level variable declarations instead of enum declarations. Because OpenGL doesn't actually use an enum, you'll have to explicitly construct a GLenum
with GL_RENDERBUFFER
as its primitive value:
glBindRenderbuffer(GLenum(GL_RENDERBUFFER), 0)
Upvotes: 5