18

I can't seem to include glu.h in my Android NDK project.

I'm trying to port existing C++ code to NDK, and it uses glu in a few places (notably gluErrorString).

Does OpenGLES not have glu?

Is there a port I can use?

If not I can probably remove the calls to things like gluPerspective and so on, but what do I do about gluErrorString?

Lukas Knuth
  • 25,449
  • 15
  • 83
  • 111
DaedalusFall
  • 8,335
  • 6
  • 30
  • 43
  • Was my answer useful for you or you would like to wait for another solution? – Volo Oct 11 '11 at 16:22
  • Sorry Idolon, that was rather rude or me but I've been busy. Fortunately it still lets me award the rep, and I have done so. – DaedalusFall Oct 11 '11 at 18:30
  • NP, we all have real life ;) That's why 24 hours grace period [has been added](http://meta.stackexchange.com/q/49830/158912) recently to the bounty system. Thanks for the rep. – Volo Oct 12 '11 at 11:34

1 Answers1

15

Does OpenGL ES not have glu?

No, it doesn't. Look at this: Platform OpenGL Includes collection. Under Android there are only the following headers:

OpenGL ES 1.1:

#include <GLES/gl.h>
#include <GLES/glext.h>

OpenGL ES 2.0:

#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>

Is there a port I can use?

Yes, there is a partial port of GLU for Android - GLU ES (it supports gluErrorString, gluPerspective and numerous other functions):

GLU 1.3 partitial port (libutil and libtess components only) for OpenGL ES 1.x (CM - Common profile) and above.

This port supports:

  • Quadrics: gluNewQuadric(), gluDeleteQuadric(), gluQuadricCallback(), gluQuadricNormals(), gluQuadricTexture(), gluQuadricOrientation(), gluQuadricDrawStyle(), gluCylinder(), gluDisk(), gluPartialDisk(), gluSphere().
  • Registry: gluGetString(), gluCheckExtension(), gluErrorString().
  • Projection matrix manipulation: gluOrtho2D(), gluPerspective(), gluLookAt(), gluProject(), gluUnProject(), gluUnProject4(), gluPickMatrix(). 2D Mipmaps: gluScaleImage(), gluBuild2DMipmapLevels(), gluBuild2DMipmaps().
  • Tesselation: gluBeginPolygon(), gluDeleteTess(), gluEndPolygon(), gluGetTessProperty(), gluNewTess(), gluNextContour(), gluTessBeginContour(), gluTessBeginPolygon(), gluTessCallback(), gluTessEndContour(), gluTessEndPolygon(), gluTessNormal(), gluTessProperty(), gluTessVertex().
Volo
  • 28,673
  • 12
  • 97
  • 125
  • 5
    Thanks, that looks like a good start. Doesn't build for android out of the box, but I should be able to pull out what I need. It annoys me slightly that there seems to be a glu for android java but not android ndk. – DaedalusFall Oct 11 '11 at 18:33
  • Can you help me "pull out what I need"? Specifically I just want to be able to draw quadrics - see my new SO question: http://stackoverflow.com/questions/27346503/using-glu-es-in-android – Tony Wickham Dec 07 '14 at 18:56