On Thu, Apr 20, 2000 at 09:02:58PM -0400, Stefan Seefeld wrote:
> [EMAIL PROTECTED] wrote:
> >
> > I can't figure out how to use db to prevent flickering.
> >
> > I create a visual with 2 frames, associate a ggimesa context to it.
> > I want to render openGL and then use ggiPuts on the visual.
>
> We had the same trouble six months ago when we tried to set up berlin
> on /dev/fb for a conference. As far as I can tell Jon faked double buffering
> simply by letting both pointers point to the same buffer.
Yes, it looked like a hack in the ggiglut source when I looked at
it. If I remember correctly, I got around the problem by using a
screen mode twice as wide as I needed and using ggiSetOrigin to change
what's visible. I think it didn't work if I put the "screens" above
one another (due to the internals of ggimesa).
The relevant parts of the main loop of my program look like this:
...
if(ggiSetGraphMode(vis, wid, hei, 2*wid, hei, 0) < 0) {
...
for(;;) {
draw();
static bool first=true;
glFlush();
glFinish();
ggiFlush(vis);
ggiSetOrigin(vis, first ? 0 : wid,0);
reshape(first ? wid : 0,0,wid,hei);
glClear(GL_DEPTH_BUFFER_BIT);
ggiDrawBox(vis, first ? wid : 0,0,wid,hei);
first=!first;
}
It is neccessary here not to use glClear to clear the screen as both
"screens" get cleared then. The reshape function looks like this:
static void reshape(int x, int y, int width, int height)
{
GLfloat h = (GLfloat) height / (GLfloat) width;
glViewport((GLint) x, (GLint) y, (GLint) width, (GLint) height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-1.0, 1.0, -h, h, 5.0, 60.0);
glTranslatef(0.0, 0.0, -7.0);
glMatrixMode(GL_MODELVIEW);
}
This works great in X, but flickers when using the framebuffer as
there's no (working) way to wait for a screen retrace before doing the
ggiSetOrigin.
It'd be nice if it was possible to set what part of a visual and which
frame a ggimesa context draws on.
--
Niklas