vertexBuffObj.getVertex(); 对于(int c=0;cvertexBuffObj.getVertices(); 对于(int c=0;c,opengl-es,android-ndk,java-native-interface,Opengl Es,Android Ndk,Java Native Interface" /> vertexBuffObj.getVertex(); 对于(int c=0;cvertexBuffObj.getVertices(); 对于(int c=0;c,opengl-es,android-ndk,java-native-interface,Opengl Es,Android Ndk,Java Native Interface" />

Opengl es 德国劳埃德船级社;找不到glext.h 在试图通过NDK平台在Android中执行基于C++的程序时,编译错误,因为没有找到GL.H和GLXEX.H头文件,因为我把它们都包含在我的C++代码中。 我使用android-ndk-r8并用Cygwin编译它 here s my code: **ANDROID.MK** LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := NDK1 FILE_LIST := $(wildcard $(LOCAL_PATH)/*.cpp) LOCAL_SRC_FILES := $(FILE_LIST:$(LOCAL_PATH)/%=%) include $(BUILD_SHARED_LIBRARY) --- **APPLICATION.MK** APP_STL := stlport_static APP_ABI := armeabi armeabi-v7a APP_PLATFORM := android-3 --- **Viewer.cpp** #include <iostream> #import "OpenGLES/ES2/gl.h" #import "OpenGLES/ES2/glext.h" //#import <GLKit/GLKEffects.h> #import <GLKit/GLKMath.h> #include "Viewer.h" void Viewer::render() { glClearColor(0.65f, 0.65f, 0.65f, 1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glBindVertexArrayOES( _vertexArray[0]); // Render the object with GLKit glDrawArrays(GL_TRIANGLES, 0, 36); ///////// glBindVertexArrayOES(_vertexArray[1]); // Render the object with GLKit //[self.effect prepareToDraw]; glDrawArrays(GL_TRIANGLES, 0, 36); } void Viewer::initialize() { sceneObj.constructDemoScene(); glEnable( GL_DEPTH_TEST); /////////////////////////////////// glGenVertexArraysOES(1, &_vertexArray[0]); glBindVertexArrayOES( _vertexArray[0]); glGenBuffers(1, &_vertexBuffer[0]); glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer[0]); H3DModel * model = sceneObj.get3DModel(0); float * vertices = model->vertexBuffObj.getVertices(); for (int c = 0; c < 216; c++) printf("%f\t", vertices[c]); glBufferData(GL_ARRAY_BUFFER, 216 * 4, vertices, GL_STATIC_DRAW); glEnableVertexAttribArray( EVertexAttribPosition); glVertexAttribPointer(EVertexAttribPosition, 3, GL_FLOAT, GL_FALSE, 24, (void*) offsetof(Vertex, position)); glEnableVertexAttribArray( EVertexAttribNormal); glVertexAttribPointer(EVertexAttribNormal, 3, GL_FLOAT, GL_FALSE, 24, (void*) offsetof(Vertex, normal)); /////////////////////////////////// glGenVertexArraysOES(2, &_vertexArray[1]); glBindVertexArrayOES(_vertexArray[1]); glGenBuffers(2, &_vertexBuffer[1]); glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer[1]); H3DModel * model1 = sceneObj.get3DModel(1); float * vertices1 = model1->vertexBuffObj.getVertices(); for (int c = 0; c < 216; c++) printf("%f\t", vertices[c]); glBufferData(GL_ARRAY_BUFFER, 216 * 4, vertices1, GL_STATIC_DRAW); glEnableVertexAttribArray(EVertexAttribPosition); glVertexAttribPointer(EVertexAttribPosition, 3, GL_FLOAT, GL_FALSE, 24, (void*) offsetof(Vertex, position)); glEnableVertexAttribArray(EVertexAttribNormal); glVertexAttribPointer(EVertexAttribNormal, 3, GL_FLOAT, GL_FALSE, 24, (void*) offsetof(Vertex, normal)); glBindVertexArrayOES(0); } void Viewer::unInitialize() { glDeleteBuffers(1, &_vertexBuffer[0]); glDeleteBuffers(2, &_vertexBuffer[1]); glDeleteVertexArraysOES(1, &_vertexArray[0]); glDeleteVertexArraysOES(2, &_vertexArray[1]); if (_program) { glDeleteProgram( _program); _program = 0; } } GLKMatrix4 Viewer::update() { GLKMatrix4 baseModelViewMatrix = GLKMatrix4MakeTranslation(0.0f, 0.0f, -4.0f); baseModelViewMatrix = GLKMatrix4Rotate(baseModelViewMatrix, _rotation, 0.0f, 1.0f, 0.0f); // Compute the model view matrix for the object rendered with GLKit //GLKMatrix4 modelViewMatrix = GLKMatrix4MakeTranslation(0.0f, 0.0f, -1.5f); //modelViewMatrix = GLKMatrix4Rotate(modelViewMatrix, _rotation, 1.0f, 1.0f, 1.0f); //modelViewMatrix = GLKMatrix4Multiply(baseModelViewMatrix, modelViewMatrix); //self.effect.transform.modelviewMatrix = baseModelViewMatrix; /*// Compute the model view matrix for the object rendered with ES2 modelViewMatrix = GLKMatrix4MakeTranslation(0.0f, 0.0f, 1.5f); modelViewMatrix = GLKMatrix4Rotate(modelViewMatrix, _rotation, 1.0f, 1.0f, 1.0f); modelViewMatrix = GLKMatrix4Multiply(baseModelViewMatrix, modelViewMatrix); _normalMatrix = GLKMatrix3InvertAndTranspose(GLKMatrix4GetMatrix3(modelViewMatrix), NULL); _modelViewProjectionMatrix = GLKMatrix4Multiply(projectionMatrix, modelViewMatrix);*/ _rotation += 0.04f; return baseModelViewMatrix; } 这是我的代码: **ANDROID.MK** 本地路径:=$(调用我的目录) 包括$(清除变量) 本地_模块:=NDK1 文件列表:=$(通配符$(本地路径)/*.cpp) 本地\u SRC\u文件:=$(文件列表:$(本地\u路径)/%=%) 包括$(构建共享库) --- **APPLICATION.MK** 应用程序\u STL:=stlport\u静态 APP_ABI:=armeabi armeabi-v7a 应用程序平台:=android-3 --- **Viewer.cpp** #包括 #导入“OpenGLES/ES2/gl.h” #导入“OpenGLES/ES2/glext.h” //#进口 #进口 #包括“Viewer.h” void查看器::render(){ glClearColor(0.65f、0.65f、0.65f、1.0f); glClear(GL_颜色_缓冲_位| GL_深度_缓冲_位); GLBindVertexArray(_vertexArray[0]); //使用GLKit渲染对象 gldrawArray(GL_三角形,0,36); ///////// GLBindVertexarray(_vertexArray[1]); //使用GLKit渲染对象 //[自生效准备提款]; gldrawArray(GL_三角形,0,36); } void查看器::初始化(){ sceneObj.constructDemoScene(); glEnable(GLU深度试验); /////////////////////////////////// glgenvertexarray(1,&u vertexArray[0]); GLBindVertexArray(_vertexArray[0]); glGenBuffers(1,&_vertexBuffer[0]); glBindBuffer(GL_数组_BUFFER,_vertexBuffer[0]); H3DModel*model=sceneObj.get3DModel(0); 浮点*顶点=模型->vertexBuffObj.getVertex(); 对于(int c=0;cvertexBuffObj.getVertices(); 对于(int c=0;c

Opengl es 德国劳埃德船级社;找不到glext.h 在试图通过NDK平台在Android中执行基于C++的程序时,编译错误,因为没有找到GL.H和GLXEX.H头文件,因为我把它们都包含在我的C++代码中。 我使用android-ndk-r8并用Cygwin编译它 here s my code: **ANDROID.MK** LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := NDK1 FILE_LIST := $(wildcard $(LOCAL_PATH)/*.cpp) LOCAL_SRC_FILES := $(FILE_LIST:$(LOCAL_PATH)/%=%) include $(BUILD_SHARED_LIBRARY) --- **APPLICATION.MK** APP_STL := stlport_static APP_ABI := armeabi armeabi-v7a APP_PLATFORM := android-3 --- **Viewer.cpp** #include <iostream> #import "OpenGLES/ES2/gl.h" #import "OpenGLES/ES2/glext.h" //#import <GLKit/GLKEffects.h> #import <GLKit/GLKMath.h> #include "Viewer.h" void Viewer::render() { glClearColor(0.65f, 0.65f, 0.65f, 1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glBindVertexArrayOES( _vertexArray[0]); // Render the object with GLKit glDrawArrays(GL_TRIANGLES, 0, 36); ///////// glBindVertexArrayOES(_vertexArray[1]); // Render the object with GLKit //[self.effect prepareToDraw]; glDrawArrays(GL_TRIANGLES, 0, 36); } void Viewer::initialize() { sceneObj.constructDemoScene(); glEnable( GL_DEPTH_TEST); /////////////////////////////////// glGenVertexArraysOES(1, &_vertexArray[0]); glBindVertexArrayOES( _vertexArray[0]); glGenBuffers(1, &_vertexBuffer[0]); glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer[0]); H3DModel * model = sceneObj.get3DModel(0); float * vertices = model->vertexBuffObj.getVertices(); for (int c = 0; c < 216; c++) printf("%f\t", vertices[c]); glBufferData(GL_ARRAY_BUFFER, 216 * 4, vertices, GL_STATIC_DRAW); glEnableVertexAttribArray( EVertexAttribPosition); glVertexAttribPointer(EVertexAttribPosition, 3, GL_FLOAT, GL_FALSE, 24, (void*) offsetof(Vertex, position)); glEnableVertexAttribArray( EVertexAttribNormal); glVertexAttribPointer(EVertexAttribNormal, 3, GL_FLOAT, GL_FALSE, 24, (void*) offsetof(Vertex, normal)); /////////////////////////////////// glGenVertexArraysOES(2, &_vertexArray[1]); glBindVertexArrayOES(_vertexArray[1]); glGenBuffers(2, &_vertexBuffer[1]); glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer[1]); H3DModel * model1 = sceneObj.get3DModel(1); float * vertices1 = model1->vertexBuffObj.getVertices(); for (int c = 0; c < 216; c++) printf("%f\t", vertices[c]); glBufferData(GL_ARRAY_BUFFER, 216 * 4, vertices1, GL_STATIC_DRAW); glEnableVertexAttribArray(EVertexAttribPosition); glVertexAttribPointer(EVertexAttribPosition, 3, GL_FLOAT, GL_FALSE, 24, (void*) offsetof(Vertex, position)); glEnableVertexAttribArray(EVertexAttribNormal); glVertexAttribPointer(EVertexAttribNormal, 3, GL_FLOAT, GL_FALSE, 24, (void*) offsetof(Vertex, normal)); glBindVertexArrayOES(0); } void Viewer::unInitialize() { glDeleteBuffers(1, &_vertexBuffer[0]); glDeleteBuffers(2, &_vertexBuffer[1]); glDeleteVertexArraysOES(1, &_vertexArray[0]); glDeleteVertexArraysOES(2, &_vertexArray[1]); if (_program) { glDeleteProgram( _program); _program = 0; } } GLKMatrix4 Viewer::update() { GLKMatrix4 baseModelViewMatrix = GLKMatrix4MakeTranslation(0.0f, 0.0f, -4.0f); baseModelViewMatrix = GLKMatrix4Rotate(baseModelViewMatrix, _rotation, 0.0f, 1.0f, 0.0f); // Compute the model view matrix for the object rendered with GLKit //GLKMatrix4 modelViewMatrix = GLKMatrix4MakeTranslation(0.0f, 0.0f, -1.5f); //modelViewMatrix = GLKMatrix4Rotate(modelViewMatrix, _rotation, 1.0f, 1.0f, 1.0f); //modelViewMatrix = GLKMatrix4Multiply(baseModelViewMatrix, modelViewMatrix); //self.effect.transform.modelviewMatrix = baseModelViewMatrix; /*// Compute the model view matrix for the object rendered with ES2 modelViewMatrix = GLKMatrix4MakeTranslation(0.0f, 0.0f, 1.5f); modelViewMatrix = GLKMatrix4Rotate(modelViewMatrix, _rotation, 1.0f, 1.0f, 1.0f); modelViewMatrix = GLKMatrix4Multiply(baseModelViewMatrix, modelViewMatrix); _normalMatrix = GLKMatrix3InvertAndTranspose(GLKMatrix4GetMatrix3(modelViewMatrix), NULL); _modelViewProjectionMatrix = GLKMatrix4Multiply(projectionMatrix, modelViewMatrix);*/ _rotation += 0.04f; return baseModelViewMatrix; } 这是我的代码: **ANDROID.MK** 本地路径:=$(调用我的目录) 包括$(清除变量) 本地_模块:=NDK1 文件列表:=$(通配符$(本地路径)/*.cpp) 本地\u SRC\u文件:=$(文件列表:$(本地\u路径)/%=%) 包括$(构建共享库) --- **APPLICATION.MK** 应用程序\u STL:=stlport\u静态 APP_ABI:=armeabi armeabi-v7a 应用程序平台:=android-3 --- **Viewer.cpp** #包括 #导入“OpenGLES/ES2/gl.h” #导入“OpenGLES/ES2/glext.h” //#进口 #进口 #包括“Viewer.h” void查看器::render(){ glClearColor(0.65f、0.65f、0.65f、1.0f); glClear(GL_颜色_缓冲_位| GL_深度_缓冲_位); GLBindVertexArray(_vertexArray[0]); //使用GLKit渲染对象 gldrawArray(GL_三角形,0,36); ///////// GLBindVertexarray(_vertexArray[1]); //使用GLKit渲染对象 //[自生效准备提款]; gldrawArray(GL_三角形,0,36); } void查看器::初始化(){ sceneObj.constructDemoScene(); glEnable(GLU深度试验); /////////////////////////////////// glgenvertexarray(1,&u vertexArray[0]); GLBindVertexArray(_vertexArray[0]); glGenBuffers(1,&_vertexBuffer[0]); glBindBuffer(GL_数组_BUFFER,_vertexBuffer[0]); H3DModel*model=sceneObj.get3DModel(0); 浮点*顶点=模型->vertexBuffObj.getVertex(); 对于(int c=0;cvertexBuffObj.getVertices(); 对于(int c=0;c,opengl-es,android-ndk,java-native-interface,Opengl Es,Android Ndk,Java Native Interface,提前感谢…我想知道如何在android ndk中使用OPENGL ES 不太确定,但我相信如果您查看google ndk提供的示例代码,它可能会有很大帮助 示例代码位于 android-ndk-r7b\samples\hello-gl2\jni\gl_code.cpp 如果比较Android.mk,您会发现 LOCAL_LDLIBS := -llog -lGLESv2 他失踪了。谷歌提供的Android.mk如下所示: LOCAL_PATH:= $(call m

提前感谢…我想知道如何在android ndk中使用OPENGL ES

不太确定,但我相信如果您查看google ndk提供的示例代码,它可能会有很大帮助

示例代码位于

    android-ndk-r7b\samples\hello-gl2\jni\gl_code.cpp
如果比较Android.mk,您会发现

    LOCAL_LDLIBS    := -llog -lGLESv2
他失踪了。谷歌提供的Android.mk如下所示:

    LOCAL_PATH:= $(call my-dir)

    include $(CLEAR_VARS)

    LOCAL_MODULE    := libgl2jni
    LOCAL_CFLAGS    := -Werror
    LOCAL_SRC_FILES := gl_code.cpp
    LOCAL_LDLIBS    := -llog -lGLESv2

    include $(BUILD_SHARED_LIBRARY)
此外,在cpp源代码中,android使用:

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

不太确定,但我相信如果您查看google ndk提供的示例代码,它可能会有很大帮助

示例代码位于

    android-ndk-r7b\samples\hello-gl2\jni\gl_code.cpp
如果比较Android.mk,您会发现

    LOCAL_LDLIBS    := -llog -lGLESv2
他失踪了。谷歌提供的Android.mk如下所示:

    LOCAL_PATH:= $(call my-dir)

    include $(CLEAR_VARS)

    LOCAL_MODULE    := libgl2jni
    LOCAL_CFLAGS    := -Werror
    LOCAL_SRC_FILES := gl_code.cpp
    LOCAL_LDLIBS    := -llog -lGLESv2

    include $(BUILD_SHARED_LIBRARY)
此外,在cpp源代码中,android使用:

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

在C/C++中没有导入这样的东西。此外,您还需要提高应用程序平台的级别。OpenGL ES 1只能从
android-4
获得,OpenGL ES 2可以从
android-5
获得。所有内容都在文档中:
docs/STABLE-api.html
文件。

在C/C++中没有导入这样的东西。此外,您还需要提高应用程序平台的级别。OpenGL ES 1只能从
android-4
获得,OpenGL ES 2可以从
android-5
获得。所有内容都在文档中:
docs/STABLE-api.html
文件。

我认为您试图在jni目录中构建。T