Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: glTexImage2D() error 0x502

  1. #1
    Junior Member Newbie
    Join Date
    Oct 2011

    glTexImage2D() error 0x502


    I got problem with glTexImage2D(). Call I placed below causes error 0x502 which I belive is GL_INVALID_OPERATION.

    Code :
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F_ARB, image.xres, image.yres, 0, GL_RGBA, GL_FLOAT,; is of type Color[] and Color is defined like this:

    Code :
    struct Color {
        float r, g, b, a;

    It works with internalFormat GL_RGB, but it's not good for me.
    I want to register this texture with CUDA and for that purpose it has to be 1, 2 or 4 component per element.

    InternaFormat GL_RGBA doesn't work either.

    What am I missing? Reference manual doesn't say much about GL_INVALID_OPERATION (well, it seems to me that, stated possible occurences of this error don't apply to my case)

    Please help,

  2. #2
    Super Moderator OpenGL Guru
    Join Date
    Feb 2000
    Montreal, Canada

    Re: glTexImage2D() error 0x502

    I looked at GL_INVALID_OPERATION and I don't see a reason for it either.

    InternaFormat GL_RGBA doesn't work either.
    because that would be plain old GL_RGBA8 which is available since GL 1.1
    an open source GLU replacement library. Much more modern than GLU.
    float matrix[16], inverse_matrix[16];
    glhTranslatef2(matrix, 0.0, 0.0, 5.0);
    glhRotateAboutXf2(matrix, angleInRadians);
    glhScalef2(matrix, 1.0, 1.0, -1.0);
    glhQuickInvertMatrixf2(matrix, inverse_matrix);
    glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
    glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts