Jump to content
  • Advertisement
Sign in to follow this  
Giedrius

OpenGL Accumulation buffer

This topic is 3754 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am having some issues with the accumulation buffer. I tried using this code in my drawing function:
glClearAccum(0.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_ACCUM_BUFFER_BIT);
glRotatef(m_Rotation, 0.0f, 0.0f, 1.0f); //m_Rotation is incremented in Update function
for (int i=0; i<4; i++)
{
	glPushMatrix();

	glRotatef(i * 170, 0.0f, 0.0f, 1.0f);

	//a rectangle
	glBegin(GL_QUADS);
	glColor4f(1.0f,0.0f,0.0f,0.5);
	glVertex2i(-50,-50);
	glColor4f(0.0f,1.0f,0.0f,0.5);
	glVertex2i(50,-50);
	glColor4f(0.0f,0.0f,1.0f,0.5);
	glVertex2i(50,50);
	glColor4f(1.0f,1.0f,1.0f,0.5);
	glVertex2i(-50,50);
	glEnd();

	glPopMatrix();

	glAccum(GL_ACCUM, 0.1);
}

glAccum(GL_RETURN, 0.005);


It seems that the value given for the glAccum functions has no effect. I tried a whole lot of different values, but the result is always the same. Or does the accumulation buffer require some initialization? I haven't seen anything said about it in several pages on the accumulation buffer. I also tried to run all the glAccum examples I found on the internet, but none of them produced the same output as in their screenshots on the internet, which led me to suspect that my video card drivers were buggy. After updating them to the latest version, the examples still don't work correctly. (My video card is ASUS x1900xt). What I eventually want to achieve is to use the OpenGL accumulation buffer to blend together multiple passes of drawing to form the final frame.

Share this post


Link to post
Share on other sites
Advertisement
Never mind that, I forgot to initialize the accumulation buffer when initializing the window.

For those, who may be having the same problem and may stumble across this post, you have to set the accumulation buffer values in the pixel format descriptor. I did it like this:


//PIXELFORMATDESCRIPTOR pfd;
pfd.cAccumBits = 32 * 4; //I didn't find any information on MSDN about what value this member should be.
//This is my guess, I would appreciate if anyone could clarify this.
pfd.cAccumRedBits = pfd.cAccumGreenBits = pfd.cAccumBlueBits = pfd.cAccumAlphaBits = 32;


Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!