hi,
I worked with Qt/embedded4.6 on OMAP3 platform with SGX OES2 enabled.
it is ok to run hello_es2 . but When trying to draw a camera video at scene backgroun
just following boxdemo provided, it always fail. the program runed just show background color. the logged report:
-----------------------------------------------------
Unrecognised OpenGL version
QEglContext::swapBuffers(): "Bad native window (0x300B)"
QEglContext::swapBuffers(): "Bad native window (0x300B)"
QEglContext::swapBuffers(): "Bad native window (0x300B)"
QEglContext::swapBuffers(): "Bad native window (0x300B)"
QEglContext::swapBuffers(): "Bad native window (0x300B)"
QEglContext::swapBuffers(): "Bad native window (0x300B)"
QEglContext::swapBuffers(): "Bad native window (0x300B)"
QEglContext::swapBuffers(): "Bad native window (0x300B)"
QEglContext::swapBuffers(): "Bad native window (0x300B)"
QEglContext::swapBuffers(): "Bad native window (0x300B)"
QEglContext::swapBuffers(): "Bad native window (0x300B)"
QEglContext::swapBuffers(): "Bad native window (0x300B)"
QEglContext::swapBuffers(): "Bad native window (0x300B)"
QEglContext::swapBuffers(): "Bad native window (0x300B)"
my drawbackground function is as below
float width = float(painter->device()->width());
float height = float(painter->device()->height());
painter->beginNativePainting();
glViewport(0,0,width,height);
glClearColor(0, 0.2, 0.1f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, m_uiTexture);
if(!waitLogo)
{
int buffer_width=320;
int buffer_height=240;
if(! m_camera->m_fotoReady)
{
GstBuffer* buf=(m_camera->refresh_buffer()); //manually call appsink to fetch for data in the buffer
// //unsigned char* data=(unsigned char *) GST_BUFFER_DATA (CameraN900::buffer);
//if(m_camera->m_streamReady)
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGB, buffer_width,buffer_height, 0, GL_RGB, GL_UNSIGNED_BYTE, m_camera->m_buffer);
m_camera->release_buffer(buf);
} else
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGB, buffer_width,buffer_height, 0, GL_RGB, GL_UNSIGNED_BYTE, m_camera->m_buffer);
} else
{
QImage image=QImage(":icons/qt.png");//,QImage::Format_RGB888);
char * imgData=(char*)image.bits();
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGB, 128,128, 0, GL_RGB, GL_UNSIGNED_BYTE, imgData);
}
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
glFrontFace(GL_CW);
glCullFace(GL_FRONT);
glEnable(GL_CULL_FACE);
// glEnable(GL_DEPTH_TEST);
QMatrix4x4 modelview;
if (waitLogo) {
modelview.rotate(m_fAngle, 0.0f, 1.0f, 0.0f);
modelview.rotate(m_fAngle, 1.0f, 0.0f, 0.0f);
modelview.rotate(m_fAngle, 0.0f, 0.0f, 1.0f);
modelview.scale(m_fScale);
modelview.translate(0.0f, -0.2f, 0.0f);
program1.bind();
program1.setUniformValue(matrixUniform1, modelview);
paintWaitLogo();
program1.release();
} else {
modelview.scale(m_fScale);
program2.bind();
program2.setUniformValue(matrixUniform2, modelview); //program1.setUniformValue(matrixUniform2, modelview);
paintTextured();
program2.release();
}
glDisable(GL_DEPTH_TEST);
glDisable(GL_CULL_FACE);
painter->endNativePainting();
QString framesPerSecond;
framesPerSecond.setNum(frames /(time.elapsed() / 1000.0), 'f', 2);
painter->setPen(Qt::white);
painter->drawText(20, 40, framesPerSecond + " fps");
other part of code just as the demo did ,any help for that?
Bookmarks