View Full Version : bad behavior of wglReleaseTexImageARB

04-17-2004, 04:59 PM
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);

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.

04-17-2004, 05:19 PM
Why are you fooling with MakeCurrent when you release. As far as I know, you only need to do that before drawing to the texture.

Basic proceedure:



Your call may fail becuse there is no context for it.

04-18-2004, 10:23 AM
Looking at NVidia's render_to_texture from their SDK, I solved it.

It looks like the problem comes from not having the right texture bound. So I guess you need to make a context current and also call glBindTexture before releasing or binding.

So you are partly correct.

04-18-2004, 10:30 AM
I assumed that it goes without saying that you need a current context before you make context specific calls. :)

By the way, i agree with you. It would be nice if some day the whole wgl business went away.