www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/04/24/13:36:45

Xref: news2.mv.net comp.os.msdos.djgpp:3049
From: ey200 AT hermes DOT cam DOT ac DOT uk (E. Young)
Newsgroups: comp.os.msdos.djgpp
Subject: double buffering with GRX2.0
Date: 24 Apr 1996 09:31:23 GMT
Organization: University of Cambridge, England
Lines: 35
Message-ID: <4lksdb$jro@lyra.csx.cam.ac.uk>
NNTP-Posting-Host: hammer.thor.cam.ac.uk
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I'm trying to double buffer an SVGA screen; the code below is my attempt.
Everything is fine, except a certain amount of screen flicker. Can anyone tell me
why this is happening? The same "wait" function works fine for VGA screens
using DJGPP, giving a rock-steady picture.
   Thanks,

-Edwin

#include <gppconio.h>
#include <dos.h>
#include <grx20.h>

void WaitRetrace();

main()
{
	// virtual screen 2x as high as visible screen
	GrSetMode(GR_custom_graphics,640,480,256,640,960);

	int i=0;
	while(!kbhit()){
           // fill other screen with colour
	   GrFilledBox(0,  (GrViewportY() ? 0 : 480),
                       639,(GrViewportY() ? 0 : 480)+479,i++);
	   WaitRetrace();
	   GrSetViewport(0,480-GrViewportY());
	}
	GrSetMode(GR_default_text);
}

void WaitRetrace() {
   while(!inportb(0x03DA) & 0x08);
   while(!inportb(0x03DA) & 0x08);
}

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019