Using GLU ES in Android
Asked Answered
P

1

3

so I want to draw simple shapes (cylinders, spheres, and cones) in my Android app. Based on this question and answer, it seems like it is possible to port GLU into Android, which has exactly those functions I need. However, I am having trouble getting it to compile. So far I have tried the following:

  1. Download glues-1.4-bin-qnx.tar.gz from the glues download page
  2. Create a new module ("glues") in my Android project, with the include/ files from the download above and libGLUES_CM.a
  3. Include this module in my jni/Android.mk

Here is my glues/Android.mk

LOCAL_PATH:= $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := glues
LOCAL_SRC_FILES := lib/libGLUES_CM.a
LOCAL_CFLAGS := -IC:/usr/src/android-ndk-r10c/platforms/android-9/arch-arm/usr/include \
                -IC:/usr/src/android-ndk-r10c/platforms/android-9/arch-arm/usr/include/sys
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include

include $(PREBUILT_STATIC_LIBRARY)

And my jni/Android.mk:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE    := opengl
NDK_MODULE_PATH := $(LOCAL_PATH)/..
LOCAL_CPPFLAGS  := -I/usr/include
LOCAL_STATIC_LIBRARIES := glues
LOCAL_SRC_FILES := com_wickhambros_charactercreator_OpenGlJniWrapper.cpp
LOCAL_LDLIBS := -llog -landroid -lGLESv2 -lGLESv1_CM -lEGL -lm

include $(BUILD_SHARED_LIBRARY)

$(call import-add-path,$(LOCAL_PATH)/..)

$(call import-module,glues)

When I build, I get this error: glues/include/glues.h:54:5: error: #error "Platform is unsupported"

Prepossession answered 7/12, 2014 at 18:54 Comment(0)
M
0

QNX is probably not what you want.

Instead you will need to compile the sources for Android. I managed almost to get it to compile by adding the following lines to the header files where it complains with "Platform is unsupported"

#elif defined (ANDROID)
  #include <GLES/gl.h>
  #include <GLES/glext.h>
  #define APIENTRY
  #define GLAPI

I failed on GL_CLIENT_PIXEL_STORE_BIT which is used in glues_mipmap.c and cannot be found in the android ndk.

It is well possible that your requirements are satisfied if you just build without this file.

Might answered 19/1, 2015 at 22:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.