Skip to main content
GameDev.net gamedev.net
🔒 Locked

PBuffer Alpha

Started by Limedark Aug 22, 2011 at 6:38 PM 0 replies 1.2k views
Original Post
Limedark
Limedark
(Edit: No worry, I found the answer. And the answer is "I'm dumb" :-P I'll see if I can delete this silly question and save face :-D )

Hello, I came to this place from Neon Helium's excellent lessons/tutorials, and if someone here can help me even a fraction of how much the NeHe page has, I will be forever grateful, and humbled :-)

I am dabbling with one of the few non-NeHe sources I have located for a project of mine. It deals with PBuffers: http://www.codesampl...rc/oglsrc_7.htm (I use the version #1 code they have).

I have made it work, and it works rather nicely, but a problem remains: When I use my dynamically updated texture (the one that is derived from the pbuffer), the alpha background becomes non-alpha, a flat surface using the color of the window (i.e. not the pbuffer) for background. If I reduce pbuffer glClearColor's alpha, it simply blends the two set background colors together, it does _not_ make the dynamic texture transparent :-( All other texture alphas work without any problems. It's only the dynamic texture, and I do not know why...

I will spare you the entirety of my setup, but this is the basic settings for the main window:


glEnable(GL_TEXTURE_2D);
glShadeModel(GL_SMOOTH);
glClearColor(0.5f, 0.75f, 1.0f, 0.0f);
glClearDepth(1.0f);
glEnable(GL_DEPTH_TEST);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
glDepthFunc(GL_LEQUAL);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);

... and this is what the pbuffer works with:

glEnable(GL_TEXTURE_2D);
glShadeModel(GL_SMOOTH);
glClearColor(1.0f, 1.0f, 1.0f, 0.4f);
glClearDepth(1.0f);
glEnable(GL_DEPTH_TEST);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
glDepthFunc(GL_LEQUAL);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);

I'm not skilled enough to do anything more elegant, but it has taken me pretty far, and I would love it if something or someone could let me go farther, by helping me enable dynamic texture transparency!

For anything you may think, thanks in advance :-)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.