GlTexImage2D GL_INVALID_OPERATION on RGBA data



  • Hello everybody,
    In the process or creating a texture of RGBA data, I execute the command:

    glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA,(GLsizei)m_bsize[0],(GLsizei)m_bsize[1],0,GL_RGBA,GL_UNSIGNED_INT_8_8_8_8_REV,m_ptr);
    

    This call causes glGetError() to return GL_OPERATION_INVALID. As there are many different reasons why that particular error can be generated for this function, I'm hoping somebody has in the past worked with RGBA data and can give me something to check for. Thus far whatever the problem is, I haven't found it.

    m_ptr is of type unsigned char*, but actually stores the RGB data in 4 byte blocks of RED,BLUE,GREEN,ALPHA values at offsets of 0,1,2,3 respectively. bsize[0] is the width, and bsize[1] is the height of the image.



  • I see that nobody posted a reply for this post I made a month ago (almost). Actually, this is an OpenGL issue, not a QT issue for starters. Qt does support OpenGL, and does have various functions to support it, but this particular problem turned out to be solely an OpenGL issue. In short, the problem I had was that I was creating my texture using one set of m_bsize[2] (width,height), but then creating the texture using this command with a different bsize[2]. Everything else in the command is correct. I've discovered that OpenGL has functions that can retrieve the size of a previously created texture, so if anybody else should have this issue, I highly reccomend retrieving this state information from the object instead of trying to maintain the object state yourself (which was the mistake I made).


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.