这是第一次在这里发布,是openGL的新手。我试图用鱼眼校正(使用片段着色器)显示摄像机内容。它的工作正常,但有时在整个屏幕上会出现白色闪烁,并且在闪烁期间出现以下错误代码。
NCGSYS_FrameMemAlloc : AllocateAnyMemoryRegion (Kernel) failed - 138.
从共享内存中获取相机数据(buf)并进行如下处理
glGenTextures(1, &textureID);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1024, 600, 0, GL_RGBA, GL_UNSIGNED_BYTE, (GLvoid*)buf);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); // Linear Filtering
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); // Linear Filtering
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glVertexAttribPointer ( positionLoc, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), vVertices );
glVertexAttribPointer ( texCoordLoc, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), &vVertices[3] );
glEnableVertexAttribArray ( positionLoc );
glEnableVertexAttribArray ( texCoordLoc );
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glClearColor(0.0, 0.0, 0.0, 1.0);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D,textureID);
glDrawElements ( GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices );
Call eglSwapBuffers().