android-ndk, glGenVertexArraysOES not found
Asked Answered
G

2

6

I want to use VAO in my native-c application for Android.

The problem is, that GL_OES_vertex_array_object is supported and I can even get the addresses of glBindVertexArrayOES and glDeleteVertexArraysOES but glGenVertexArraysOES is not found.

Does the presence of GL_OES_vertex_array_object mean that all these functions can be accessed?

My code for VAO initialization:

std::string vao = "GL_OES_vertex_array_object";

if ( isExtensionSupported ( vao.c_str () ) != 0 )
{
    LOG ( vao << " supported" );
    glBindVertexArrayOES = (PFNGLBINDVERTEXARRAYOESPROC)eglGetProcAddress ( "glBindVertexArrayOES" );
    if ( !glBindVertexArrayOES )
        LOG ( "Can't get proc address: glBindVertexArrayOES" );

    glDeleteVertexArraysOES = (PFNGLDELETEVERTEXARRAYSOESPROC)eglGetProcAddress ( "glDeleteVertexArraysOES" );
    if ( !glDeleteVertexArraysOES )
        LOG ( "Can't get proc address: glDeleteVertexArraysOES" );

    glGenVertexArraysOES = (PFNGLGENVERTEXARRAYSOESPROC)eglGetProcAddress ( "glGenVertexArraysOES" );
    if ( glGenVertexArraysOES )
        LOG ( "Can't get proc address: glGenVertexArraysOES" );
}
else
{
    LOG ( vao << " not supported" );
}

Of course I get the log message

Can't get proc address: glGenVertexArraysOES

My Android.mk (shortened a little bit):

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE    := smart
LOCAL_SRC_FILES := Base/Node.cpp
...

LOCAL_LDLIBS    := -llog -landroid -lGLESv2 -lEGL
LOCAL_STATIC_LIBRARIES := nv_and_util

include $(BUILD_SHARED_LIBRARY)

$(call import-add-path, C:/NVPACK/TDK_Samples/tegra_android_native_samples_v10p00/libs/jni)
$(call import-module,nv_and_util)

Device model Samsung i9003 with Android 2.3.5

Gap answered 19/9, 2012 at 7:53 Comment(6)
What are you trying to achieve? Please copy some code snippets. What does your makefile look like? What libs do you rely on?Genseric
Reread, please, I updated the question.Gap
Is your device "real"? I hope you don't use an android emulator simulating a Samsung i9003, right? I found this post that you may be interested in. "Caution: OpenGL ES 2.0 is currently not supported by the Android Emulator. You must have a physical test device running Android 2.2 (API Level 8) or higher in order to run and test the example code in this tutorial."Genseric
Yes, it's real device and it supports OpenGL ES 2.0. Thanks for link. Now new question arises. Is here anybody, who used VAO + android ndk successfull?Gap
Maybe you should update this question's header with your new question...Genseric
I've used VAOs + android ndk successfully. I've tested devices that support it and devices that don't, but never found a device that claims to support it yet fails to actually vend the functions; but I haven't tested an i9003. I'd triple-check that you're spelling the function names correctly, though they look good above. Have you confirmed that things work on more common devices? This would indicate that it's less likely to be a code problem on your side.Altazimuth
Q
3

I just tested this....

Replace:

#include <GLES2/gl2ext.h>

With this:

#define GL_GLEXT_PROTOTYPES
#include <GLES2/gl2ext.h>

The macro GL_GLEXT_PROTOTYPES must be defined before you include gl2ext.h. There is no need to define the functions, explicitly.

Quade answered 7/1, 2016 at 2:26 Comment(0)
P
2

If that's really your code, then the bug is you're missing a '!'. Compare:

if ( !glDeleteVertexArraysOES )

to

if ( glGenVertexArraysOES )
Paleobiology answered 18/10, 2013 at 3:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.