小编K0b*_*0bi的帖子

用于FBO渲染的OpenGL ES2.0屏外上下文

我想用FBO进行屏幕外渲染(在没有任何WS的控制台环境中).我知道有必要创建一个OpenGL上下文,并且至少有一个虚拟窗口用于任何操作,因此我做了以下初始化:

// Step 1 - Get the default display.
eglDisplay = eglGetDisplay((EGLNativeDisplayType)0);

// Step 2 - Initialize EGL.
EGLint iMajorVersion, iMinorVersion;
if (!eglInitialize(eglDisplay, &iMajorVersion, &iMinorVersion))
{
    printf("Error: eglInitialize() failed.\n");
    goto cleanup;
}

// Step 3 - Make OpenGL ES the current API.
eglBindAPI(EGL_OPENGL_ES_API);
if (!TestEGLError("eglBindAPI"))
{
    goto cleanup;
}

// Step 4 - Specify the required configuration attributes.
EGLint pi32ConfigAttribs[5];
pi32ConfigAttribs[0] = EGL_SURFACE_TYPE;
pi32ConfigAttribs[1] = EGL_WINDOW_BIT;
pi32ConfigAttribs[2] = EGL_RENDERABLE_TYPE;
pi32ConfigAttribs[3] = EGL_OPENGL_ES2_BIT;
pi32ConfigAttribs[4] = EGL_NONE;

// Step 5 - Find …
Run Code Online (Sandbox Code Playgroud)

fbo off-screen windowless opengl-es-2.0

8
推荐指数
1
解决办法
6306
查看次数

标签 统计

fbo ×1

off-screen ×1

opengl-es-2.0 ×1

windowless ×1