Code Monkey home page Code Monkey logo

Comments (11)

nigels-com avatar nigels-com commented on May 19, 2024

Ideally we'd simply skip glu.h for Swift, as we already do for iOS...
Any suggestions for some preprocessor logic?

#ifndef GLEW_NO_GLU
#  ifdef __APPLE__
#    include <Availability.h>
#    if defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
#      define GLEW_NO_GLU
#    endif
#  endif
#endif

#ifndef GLEW_NO_GLU
/* this is where we can safely include GLU */
#  if defined(__APPLE__) && defined(__MACH__)
#    include <OpenGL/glu.h>
#  else
#    include <GL/glu.h>
#  endif
#endif

from glew.

nigels-com avatar nigels-com commented on May 19, 2024

I'd recommend using -DGLEW_NO_GLU for Swift, for sure.

from glew.

AE9RB avatar AE9RB commented on May 19, 2024

It's not just Swift. It's anything using clang modules on Apple. So everything Xcode too. It probably never came up before since you just "import OpenGL" in Xcode so why bother with GLEW. Which is the answer on Q&A sites.

You can't -D with the open source Swift right now. Really. The Swift package manager is very anemic. I do have GLEW working with glu and I'm hoping new Swift features will let me do something less fragile in the future. But maybe we can fix it up for everyone using modules in other languages too.

The issue is I don't know why glu is loaded so early. I assume for some platform I'm not familiar with. If that's not the case, glu can be moved to the very end of GLEW.h so it's painless everywhere. Or maybe just for Apple it's at the end. Doing Apple at the end works in my tests.

If you don't see a problem with doing Apple at the end, I can send a patch. I can also move all glu to the end. Probably easier to maintain all glu in one place. But not if it blows up some other platform.

from glew.

nigels-com avatar nigels-com commented on May 19, 2024

GLEW itself doesn't need glu.h. It's only there to maintain compatibility with applications that depend on GLU via glew.h. Isn't GLU deprecated on the Mac nowadays?

from glew.

nigels-com avatar nigels-com commented on May 19, 2024

Oh, we're dealing in pre-compiled headers here? Ouch!

from glew.

AE9RB avatar AE9RB commented on May 19, 2024

Ouch indeed. include <OpenGL/glu.h> is converted by clang into import OpenGL.GL.GLU which triggers a full pre-compiled header load of everything in OpenGL. It's all fine if you load glu at the end though.

GLEW has been broken in XCode since version 5 because of this. That's when Apple enabled clang modules.

from glew.

nigels-com avatar nigels-com commented on May 19, 2024

I have not touched XCode much since the clang migration, I guess. GNU make works just fine, of course. :-)

from glew.

nigels-com avatar nigels-com commented on May 19, 2024

Is AE9RB/SwiftCGLEW abandoned at this point? I'm reading up about Swift, especially because there is a Linux version. But I'm still not sure what all the fuss is about.

from glew.

AE9RB avatar AE9RB commented on May 19, 2024

More problems came up the further I progressed. It got to where I had to fully parse gl.xml. At that point it was easy to do everything in Swift with no dependency on C code.
https://github.com/AE9RB/SwiftGL

I don't know what everyone else is doing in Swift. But it seems to me like a good language for 3D programming. Modern syntax. Fast and easy C calls. No indeterminate delays from a GC.

from glew.

nigels-com avatar nigels-com commented on May 19, 2024

At my workplace it's all about Julia, so Swift is probably not going to be on my radar, so much.

from glew.

nigels-com avatar nigels-com commented on May 19, 2024

Nothing further for this, for now.

from glew.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.