gpt4 book ai didi

android - OGLES 2 native Android : eglCreateWindowSurface Arguments

转载 作者:搜寻专家 更新时间:2023-10-31 01:54:12 27 4
gpt4 key购买 nike

我有一个有趣的事件,一个应用程序正在开发中,在 Android 的原生 NDK C++ 上使用 OpenGL ES。程序编译运行没有问题。但是,如果我决定进行单元测试并调试代码,它会报错并显示以下消息:

Invalid arguments ' Candidates are: 
void * eglCreateWindowSurface(void *, void *, unsigned long int,
const int *) '

这与以下代码快照的最后一行相关:

    EGLint lFormat, lNumConfigs, lErrorResult;
EGLConfig lConfig;
// Defines display requirements. 16bits mode here.
const EGLint lAttributes[] = {
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
EGL_BLUE_SIZE, 5, EGL_GREEN_SIZE, 6, EGL_RED_SIZE, 5,
EGL_SURFACE_TYPE, EGL_WINDOW_BIT, EGL_RENDER_BUFFER, EGL_BACK_BUFFER,
EGL_NONE
};
// Retrieves a display connection and initializes it.
packt_Log_debug("Connecting to the display.");
mDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
if (mDisplay == EGL_NO_DISPLAY) goto ERROR;
if (!eglInitialize(mDisplay, NULL, NULL)) goto ERROR;
// Selects the first OpenGL configuration found.
packt_Log_debug("Selecting a display config.");
if(!eglChooseConfig(mDisplay, lAttributes, &lConfig, 1,
&lNumConfigs) || (lNumConfigs <= 0)) goto ERROR;
// Reconfigures the Android window with the EGL format.
packt_Log_debug("Configuring window format.");
if (!eglGetConfigAttrib(mDisplay, lConfig,
EGL_NATIVE_VISUAL_ID, &lFormat)) goto ERROR;
ANativeWindow_setBuffersGeometry(mApplication->window, 0, 0, lFormat);
// Creates the display surface.
packt_Log_debug("Initializing the display.");
mSurface = eglCreateWindowSurface(mDisplay, lConfig, mApplication->window, NULL);

我已经查看了 OGLES 引用资料,但我尝试过的所有不同方法都没有奏效。

最佳答案

将“mApplication->window”替换为“EGLNativeWindowType window”解决了问题。

关于android - OGLES 2 native Android : eglCreateWindowSurface Arguments,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10045651/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com