miyoku157
9th June 2017, 15:27
Hi,
I find a lot of way to pass a QImage to GL but in fact i retrieve a gl texture from an API. So i'm trying to convert it either in a QImage or in a QOpenGLTexture to display it. I didn't see any function that could do it. I'm still trying by retrieving the data with glteximage and trying to fill a QImage but i don't know if it will work.
This is my code to display :
void GLWidget::paintGL()
{
glClearColor(clearColor.redF(), clearColor.greenF(), clearColor.blueF(), clearColor.alphaF());
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
QMatrix4x4 m;
m.ortho(-1, 1, +1.f, -01.f, 1.0f, 20.0f);
m.translate(0.0f, 0.0f, -10.0f);
nv.StartCapture();
program->setUniformValue("matrix", m);
program->enableAttributeArray(PROGRAM_VERTEX_ATTRIBUTE);
program->enableAttributeArray(PROGRAM_TEXCOORD_ATTRIBUTE);
program->setAttributeBuffer(PROGRAM_VERTEX_ATTRIBUTE, GL_FLOAT, 0, 3, 5 * sizeof(GLfloat));
program->setAttributeBuffer(PROGRAM_TEXCOORD_ATTRIBUTE, GL_FLOAT, 3 * sizeof(GLfloat), 2, 5 * sizeof(GLfloat));
textures[0]->bind();
glDrawArrays(GL_TRIANGLE_FAN, 0 * 4, 4);
}
If you have any idea.
Thanks
I find a lot of way to pass a QImage to GL but in fact i retrieve a gl texture from an API. So i'm trying to convert it either in a QImage or in a QOpenGLTexture to display it. I didn't see any function that could do it. I'm still trying by retrieving the data with glteximage and trying to fill a QImage but i don't know if it will work.
This is my code to display :
void GLWidget::paintGL()
{
glClearColor(clearColor.redF(), clearColor.greenF(), clearColor.blueF(), clearColor.alphaF());
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
QMatrix4x4 m;
m.ortho(-1, 1, +1.f, -01.f, 1.0f, 20.0f);
m.translate(0.0f, 0.0f, -10.0f);
nv.StartCapture();
program->setUniformValue("matrix", m);
program->enableAttributeArray(PROGRAM_VERTEX_ATTRIBUTE);
program->enableAttributeArray(PROGRAM_TEXCOORD_ATTRIBUTE);
program->setAttributeBuffer(PROGRAM_VERTEX_ATTRIBUTE, GL_FLOAT, 0, 3, 5 * sizeof(GLfloat));
program->setAttributeBuffer(PROGRAM_TEXCOORD_ATTRIBUTE, GL_FLOAT, 3 * sizeof(GLfloat), 2, 5 * sizeof(GLfloat));
textures[0]->bind();
glDrawArrays(GL_TRIANGLE_FAN, 0 * 4, 4);
}
If you have any idea.
Thanks