Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable the use of VAOs on mac using apple extensions. #55

Closed
schell opened this issue Aug 26, 2014 · 4 comments
Closed

Enable the use of VAOs on mac using apple extensions. #55

schell opened this issue Aug 26, 2014 · 4 comments

Comments

@schell
Copy link

schell commented Aug 26, 2014

I'm trying to use VAOs but mac requires the use of apple specific extension functions. Apple's VAO docs. It seems there are apple extension functions in OpenGLRaw What's the best way to integrate this? Double up all VAO functions with *Apple versions?

@svenpanne
Copy link
Member

The underlying mechanism in OpenGLRaw already takes care of the various vendor suffixes like "APPLE", see https://github.com/haskell-opengl/OpenGLRaw/blob/master/src/Graphics/Rendering/OpenGL/Raw/Extensions.hs. On the Haskell side you normally only see the suffix-free names, but glBindVertexArrayAPPLE is an exception: It has different semantics than the ARB version of glBindVertexArray (the latter requires all ids to have been previously generated by glGenVertexArrays, while the former auto-generates an id if required). Therefore, OpenGLRaw exposes both versions, the ARB one without a suffix and the Apple version with an "APPLE" suffix. Luckily, such semantic difference are extremely rare when extensions are promoted.

So hopefully there is nothing to do for you, just drop the suffix. It might be the case that you have to use a feature from an Apple extension which is not yet in OpenGLRaw, it would be good to hear if that's the case or not.

@schell
Copy link
Author

schell commented Aug 26, 2014

Okay, thanks for the explanation. I'm trying to use VAOs through GLUtils but am getting an "invalid operation" error on mac for code that works on linux, from @acowley's vinyl-gl tutorial http://www.arcadianvisions.com/blog/?p=388:

dirtVAO <- makeVAO $ do enableVertices' s dirtVerts
                             bindVertices dirtVerts
                             bindBuffer ElementArrayBuffer $= Just eb
     return $ \i -> do currentProgram $= Just (program s)
                       setUniforms s i
                       withVAO grassVAO . withTextures2D [grass] $
                         drawIndexedTris numGrassTris
                       withVAO dirtVAO . withTextures2D [dirt] $
                         drawIndexedTris numDirtTris

I've run into that same "invalid operation" error on my old mac that didn't support VAOs (it had an old OpenGL). After finding the apple specific functions I figured it was an issue of having to use those. I guess I need to get this code working with OpenGLRaw first to find the actual problem or stay with my current solution of not using VAOs.

@schell schell closed this as completed Aug 26, 2014
@acowley
Copy link
Contributor

acowley commented Aug 26, 2014

@schell Please open a GLUtil or vinyl-gl issue if this is still a problem. I do most of my development on OS X, so any problems there come as a surprise!

@schell
Copy link
Author

schell commented Aug 26, 2014

@acowley I will once I figure out what's going on, thanks! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants