Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Regular Contributor
Posts: 51
Registered: ‎06-29-2011
My Device: Z10 Limited Edition
My Carrier: Ukraine GSM

Qt OpenGL problem

Hi devs!

 

I have a problem in my OpenGL ES 2.0 game. For some reason bindTexture fails with GL_INVALID_OPERATION

 

void Widget::initializeGL()
{
    QPixmap image(m_textureFile);

    glGenTextures(1, &m_texture);
    m_texture = bindTexture(image);
}

 

My Widget class is a subclass of QGLWidget http://qt-project.org/doc/qt-4.8/qglwidget.html

Should I do extra calls before I bind texture?

 

Developer
Posts: 1,280
Registered: ‎03-03-2011
My Device: Playbook, Z10, Q10, Z30 with Files & Folders and Orbit of course
My Carrier: Vodafone

Re: Qt OpenGL problem

OpenGL has some limitations on textures, among other things. You should query OpenGL capabilities before assuming anything. On BB10, the maximum texture size is either 2048 or 4096, depending on GPU. Also, support for compressed texture formats varies per GPU. See here and here for details.

Files & Folders, the unified file & cloud manager for PlayBook and BB10 with SkyDrive, SugarSync, Box, Dropbox, Google Drive, Google Docs. Free 3-day trial! - Jon Webb - Innovatology - Utrecht, Netherlands
Regular Contributor
Posts: 51
Registered: ‎06-29-2011
My Device: Z10 Limited Edition
My Carrier: Ukraine GSM

Re: Qt OpenGL problem

Innovatology, thank you for details, but I beleive Qt should handle texture formats automatically. I am using 2048x2048 PNG with alpha file for Z10 and 1024x2048 PNG with alpha for Q10. The problem is that sometimes texture is loaded and sometimes not, this is really weird. Like first time you run the app, everything is fine, and after you close it and run again, it gets OpenGL errors.