Run opengles program occured PVR error

hi experts,

i write a opengles program, when call glClear(GL_COLOR_BUFFER_BIT); occured PVR error as following:
PVR:(Error): KEGLGetDrawableParameters: No Current thread [0, ]
PVR:(Error): PrepareToDraw: Invalid drawable [0, ]
PVR:(Error): glClear: Can’t prepare to draw [0, ]

and my opengles init as following:
Int32 eglInit(stGbmSurfaceInfo *pGbmSurfInfo, uInt16 width, uInt16 height)
{
if(s_egl_info.hasInit == 1) return 0;

if(pGbmSurfInfo) {
	static const EGLint context_attribs[] = {
		EGL_CONTEXT_CLIENT_VERSION, 2,
		EGL_NONE
	};

	static const EGLint config_attribs[] = {
		EGL_RED_SIZE, 5,
		EGL_GREEN_SIZE, 6,
		EGL_BLUE_SIZE, 5,
		EGL_ALPHA_SIZE, EGL_DONT_CARE,
		EGL_DEPTH_SIZE, EGL_DONT_CARE,
		EGL_STENCIL_SIZE, EGL_DONT_CARE,
		EGL_SAMPLE_BUFFERS, 0,
		EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
		EGL_NONE
	};
	
	s_egl_info.display = eglGetDisplay(pGbmSurfInfo->pDev);

	EGLint major, minor, n;
	if (!eglInitialize(s_egl_info.display, &major, &minor)) {
		printf("failed to initialize\n");
		return -1;
	}

	printf("Using display %p with EGL version %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, &s_egl_info.config, 1, &n) || n != 1) {
		printf("failed to choose 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 context\n");
		return -1;
	}

	s_egl_info.surface = eglCreateWindowSurface(s_egl_info.display, s_egl_info.config, pGbmSurfInfo->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[] =
		"attribute vec4 a_position;							\n"
		"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, LAYER_MAX * MAX_TEXTURE_PER_LAYER * 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);

	printf("egl init finish......\n");
}
return 0;

}

could you please help me figure out the problem?

best regards!

Hi fanok,

Unfortunately we were unable to replicate your issue from the given code snippet. Could we know which device this error occurs on?

You may also want to try out the OpenGLES HelloAPI example from the PowerVR SDK and see if you are able to replicate the issue. It contains EGL context initialisation and a basic rendering similar to your application.

Best regards,
Dihara