I having some difficulties again while working with render to texture. It’s hard to explain it cause I tried various things and some of them work, some don’t.
I create a p-buffer, I release it so that I can make it current and make some GL calls but in some circumstances wglReleaseTexImageARB fails.
myfunction_CreatePbuffer(); //success
wglMakeCurrent(MainWindowDC, MainWindowGL);
glBindTexture(GL_TEXTURE_2D, 0);
wglMakeCurrent(NULL, NULL);
wglReleaseTexImageARB; //fails
GetLastError with FormatString says “The procedure could not be found”
What the hell does that mean???
Anyway, I made some changed and that part works and it still doesn’t make any sense.
In another part, I want to render to this RTT, so again I call
wglMakeCurrent(NULL, NULL);
wglReleaseTexImageARB
and it fails with the same message.
so I decieded to remove wglMakeCurrent(NULL, NULL); and now it returns 0 but the error message is “The operation completed successfully”
and then wglMakeCurrent(TexDC, TexGL);
returns 1 but nothing seems to be rendered to the texture. It always remains black.
The only thing that might explain it is that this is a MDI app with a single GL window.
When I worked with simple window or dialog based window, I had no such problems.
I must say that wgl functions suck big time.