GL_INVALID_OPERATION on glGetTexImage

Dear GL developers,

I’m trying to use the function glGetTexImage on textures generated from a movie. For some reason I get the error GL_INVALID_OPERATION and am clueless on how to solve it, what is causing it. Offcourse the array in which I want to store the data is empty.

The code that’s responsible for drawing my textures is ->

http://pastebin.com/m2e8422e6

After I try to apply glGetTexImage the texture does get drawn and displayed correctly.

If more code/info is required I’ll be more then happy to suply it. Thanks all!

When I change the call to:

glGetTexImage(target, 0, GL_RGB, GL_UNSIGNED_BYTE, buffer);

My error is gone, nevertheless my array’s still left blank. Help is really really appreciated on this one.

EDIT: Applied glReadPixels and is working now… Seemed like it was using some sort of PBuffer deep down