Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I use glu with Android NDK

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?

like image 435
DaedalusFall Avatar asked Sep 28 '11 21:09

DaedalusFall


People also ask

What can I do with Android NDK?

The Native Development Kit (NDK) is a set of tools that allows you to use C and C++ code with Android, and provides platform libraries you can use to manage native activities and access physical device components, such as sensors and touch input.

What is difference between Android NDK and SDK?

Android provides Native Development Kit (NDK) to support native development in C/C++, besides the Android Software Development Kit (Android SDK) which supports Java. [TODO] more. NDK is a complex and advanced topics.

What compiler does Android NDK use?

Code written in C/C++ can be compiled to ARM, or x86 native code (or their 64-bit variants) using the Android Native Development Kit (NDK). The NDK uses the Clang compiler to compile C/C++. GCC was included until NDK r17, but removed in r18 in 2018.

Is Android NDK required?

It still requires the use of NDK, but all the work of exposing the capabilities to Android apps has already been done.


1 Answers

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().
like image 99
Idolon Avatar answered Oct 13 '22 13:10

Idolon