Michael Labbé
Michael Labbé

Reputation: 12286

OpenGL 3.2 GL_INVALID_ENUM on glTexImage2D( GL_PROXY_TEXTURE_2D ... )

I am converting an engine from OpenGL 1.1 to OpenGL 3.2. The following throws a GL_INVALID_ENUM, but I cannot figure out why.

I am calling glGetError() prior to glTexImage2D() to clear it. When I am done, glGetError() is returning GL_INVALID_ENUM.

      glActiveTexture( GL_TEXTURE0 );
      glTexImage2D( GL_PROXY_TEXTURE_2D,   // target
                    0,                     // level
                    4,                     // internalformat
                    32, 32,                // width & height
                    0,                     // border
                    GL_RGBA,               // format
                    GL_UNSIGNED_BYTE,      // type
                    NULL );                // pixels

Upvotes: 3

Views: 2070

Answers (2)

chronospoon
chronospoon

Reputation: 637

Your internal format, "4", doesn't seem to be a valid format. For example, GL_RGBA is defined as 0x1908.

Upvotes: 2

genpfault
genpfault

Reputation: 52082

Pass in a real internalFormat. I think the pure channel count method was deprecated at some point.

Upvotes: 6

Related Questions