Using GLU ES in Android

霸气de小男生 提交于 2019-12-10 19:51:43

问题


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"


回答1:


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.



来源:https://stackoverflow.com/questions/27346503/using-glu-es-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!