This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TDA2EXEVM: PVR error

Part Number: TDA2EXEVM

hi all expert,

i write a EGL program, but when run glClear(GL_COLOR_BUFFER_BIT); some PVR error occured, the log as following:

PVR:(Error): KEGLGetDrawableParameters: No Current thread [0, ]
PVR:(Error): PrepareToDraw: Invalid drawable [0, ]
PVR:(Error): glClear: Can't prepare to draw [0, ]

my EGL init code as following:


static const EGLint context_attribs[] = {
EGL_CONTEXT_CLIENT_VERSION, 2,
EGL_NONE
};

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->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");
Init process is success.

had anyone encoutered the same problem with me?