Re: OpenGL accumulator issue
Re: OpenGL accumulator issue
- Subject: Re: OpenGL accumulator issue
- From: Mark Woollard <email@hidden>
- Date: Fri, 17 Sep 2004 15:59:02 +0100
I've tried adding glFinish and it has an effect but doesn't fix the
problem. I now get output that seems to show various steps through the
jitter process. It does appear to be load based, my code is just
rendering a number of solid spheres with glutSolidSphere, the more
precise I request the spheres the more likely it is to throw up
incomplete output. At very low precision it works as I'd expect. My
drawRect rendering code is as follows:
GLint viewport[4];
glGetIntegerv(GL_VIEWPORT, viewport);
int jitter, i;
for(jitter = 0; jitter < JITTER_ITERATIONS; jitter++)
{
glClear(GL_COLOR_BUFFER_BIT+GL_DEPTH_BUFFER_BIT+GL_STENCIL_BUFFER_BIT);
glPushMatrix();
GLfloat jitterx = jitterCoeffs[jitter].x * 2 / viewport[2];
GLfloat jittery = jitterCoeffs[jitter].y * 2 / viewport[3];
glTranslatef(jitterx, jittery, 0.0);
glColor3f(0.0, 0.0, 0.8);
glutSolidSphere(0.4, 50, 50);
for(i = 0; i < objs; i++)
{
// Code removed, gets position for an object as x, y, z
// Set origin appropriately
glLoadIdentity();
glTranslatef(x + jitterx, y + jittery, z);
glColor3f(1.0, 0.0, 0.0);
glutSolidSphere(0.05, 10, 10);
}
glPopMatrix();
glAccum(jitter==0?GL_LOAD:GL_ACCUM, 1.0 / JITTER_ITERATIONS);
}
glAccum(GL_RETURN, 1.0);
glFinish();
[[self openGLContext] flushBuffer];
On 17 Sep 2004, at 14:33, Shaun Wexler wrote:
On Sep 17, 2004, at 4:29 AM, Mark Woollard wrote:
I'm trying to write some OpenGL code within an NSOpenGLView derived
class. I have implemented my OpenGL drawing code and call it from
drawRect then issue [[self openGlcontext] flushBuffer] to output to
screen. My first pass at this worked fine. I'm now trying to use the
accumulator buffer to do anti-aliasing and am finding that sometimes
I get the anti-aliased output and sometimes the un refined output. I
assume the raw output is coming from the last pass of my jitter loop
and for some reason glAccum(GL_RETURN,..) isn't always putting its
output into the right place. I'm sure that I am generating an
anti-aliased image in the accumulator buffer and copying it out with
glAccum(GL_RETURN... each time drawRect is called so why is it going
wrong sometimes?
Is it predictable, or random? Try adding glFinish() prior to the
flushBuffer, to test if you're outpacing the card's pixel fill rate.
--
Shaun Wexler
MacFOH
http://www.macfoh.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden