GlClearColor (0.0 f, f, 0.0 0.0 f, 0.0 f);
GlClear (GL_COLOR_BUFFER_BIT);
Encountered the following error:
PVR (Error) : KEGLGetDrawableParameters: No Current thread [0]
PVR (Error) : PrepareToDraw: Invalid drawable [0]
PVR (Error) : glClear: Can 't prepare to draw [0]
EGL initialization is as follows:
(opengles version is 2.0, EGL version is 1.4, the initialization is performed successfully)
static const EGLint context_attribs []={
EGL_CONTEXT_CLIENT_VERSION, 2,
EGL_NONE
};
The static const EGLint config_attribs []={
EGL_SURFACE_TYPE EGL_WINDOW_BIT,
EGL_RED_SIZE, 8,
EGL_GREEN_SIZE, 8,
EGL_BLUE_SIZE, 8,
EGL_ALPHA_SIZE, 8,
EGL_RENDERABLE_TYPE EGL_OPENGL_ES2_BIT,
EGL_NONE
};
S_egl_info. Display=eglGetDisplay (pGbmSurfInfo - & gt; PDev);
EGLint major, minor, n.
if (! EglInitialize (s_egl_info. Display, & amp; Major, & amp; Minor)) {
Printf (" failed to initialize \ n ");
return -1;
}
Printf (" Using the display version % % p with EGL d. % d \ n ", s_egl_info. Display, major, minor);
Printf (" EGL Version \ "% s \ " n ", eglQueryString (s_egl_info. Display, EGL_VERSION));
Printf (" EGL Vendor \ "% s \ " n ", eglQueryString (s_egl_info. Display, EGL_VENDOR));
Printf (" EGL Extensions \ "% s \ " n ", eglQueryString (s_egl_info. Display, EGL_EXTENSIONS));
if (! EglBindAPI (EGL_OPENGL_ES_API)) {
Printf (" failed to bind API EGL_OPENGL_ES_API \ n ");
return -1;
}
if (! EglChooseConfig (s_egl_info. Display, config_attribs, & amp; S_egl_info. Config, 1, & amp; N) | | n!=1) {
Printf (" failed to choose the config: % d \ n ", n);
return -1;
}
S_egl_info. Context=eglCreateContext (s_egl_info. Display, s_egl_info. Config, EGL_NO_CONTEXT context_attribs);
If (s_egl_info context==NULL) {
Printf (" failed to create the context \ n ");
return -1;
}
S_egl_info. Surface=eglCreateWindowSurface (s_egl_info. Display, s_egl_info config, pGbmSurfInfo - & gt; PSurface, NULL);
If (s_egl_info. Surface==EGL_NO_SURFACE) {
Printf (" failed to create egl surface \ n ");
return -1;
}
/* connect the context to the surface */
EglMakeCurrent (s_egl_info. Display, s_egl_info surface, s_egl_info. Surface, s_egl_info. Context).
S_egl_info. UserData. WinWidth=width;
S_egl_info. UserData. WinHeight=height;
Char vShaderStr []=
"The attribute vec4 a_position;
\ n""The attribute vec2 a_texCoord;
\ n""Varying vec2 v_texCoord;
\ n""Void main () \ n"
"{\ n
""Gl_Position=a_position;
\ n""V_texCoord=a_texCoord;
\ n""} \ n ";
Char fShaderStr []=
"Precision mediump float;
\ n""Varying vec2 v_texCoord;
\ n""Uniform sampler2D s_sampler;
\ n""Void main () \ n"
"{\ n
""Gl_FragColor=texture2D (s_sampler v_texCoord);
\ n""} \ n ";
//Load the shaders and get a linked program object
S_egl_info. UserData. ProgramObject=esLoadProgram (vShaderStr fShaderStr);
If (s_egl_info. UserData. ProgramObject==0) {
EGL_LOG_ERR (" EGL load shader fail... ");
return -1;
}
GlBindAttribLocation (s_egl_info userData. ProgramObject, 0, "a_position");
GlBindAttribLocation (s_egl_info. UserData. ProgramObject, 1, "a_texCoord");
//Get the sampler location
S_egl_info. UserData. SamplerLoc=glGetUniformLocation (s_egl_info. UserData. ProgramObject, "s_sampler");
//* * Load indice data * *
GLushort indices []={0, 1, 2, 0, 2, 3};
GLushort indicesSize=sizeof (indices);
S_egl_info. UserData. Indices=(GLushort *) malloc (indicesSize);
Memcpy (s_egl_info. UserData. Indices, indices, indicesSize);
Memset (s_egl_info userData. TextureNumPerLayer, 0, sizeof (s_egl_info. UserData. TextureNumPerLayer));
Memset (s_egl_info userData. TextureIds, 0, MAX_TEXTURE_PER_LAYER LAYER_MAX * * sizeof (GLuint));
S_egl_info. UserData. IndiceNum=6;
S_egl_info. HasInit=1;
GlUseProgram (s_egl_info. UserData. ProgramObject);
GlViewport (0, 0, s_egl_info. UserData. WinWidth, s_egl_info. UserData. WinHeight);
GlEnable (GL_BLEND);
GlBlendFunc (GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA);
Printf (" egl init finish [% d % d x]... . \ n ", s_egl_info userData. WinWidth s_egl_info. UserData. WinHeight);
Anyone know what the problem with the initialization?