Swift OpenGL es list

When using Swift to create an OpenGL application, I get this error whenever I use OpenGL commands, for example:

glBindRenderbuffer(GL_RENDERBUFFER, self.colorRenderBuffer)

I get the error message ` Int32` does not convert to ' Glenum'

Any ideas how to fix this?

+4
source share
1 answer

Constants like those used by OpenGL are imported into Swift as top-level variable declarations instead of enumeration declarations. Since OpenGL does not actually use an enumeration, you need to explicitly build GLenumwith GL_RENDERBUFFERas its primitive value:

glBindRenderbuffer(GLenum(GL_RENDERBUFFER), 0)
+5
source

All Articles