Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Screen 13 flicker reduction

Status
Not open for further replies.

sandmann999

Programmer
Apr 28, 2001
52
US
Hey everyone, I'm working on some 3D graphics for a computer game I'm working on. Previously, I was using SCREEN 7 because of the pages feature, but after some optimization, I got my code to run fast enough to look good in screen 13 using the "WAIT &H3DA, 8" command for vertical retrace. My wireframe image spins and moves beautifully at 65 FPS, but when I try and draw something over the top of it, such as my title screen, which uses a pretty simple for loop that draws ONLY when the color isn't black (that way the image behind isn't even messed with), but for some reason, even though I draw it after and on top of the wire frame image, the wire frame still appears on top of it in some areas (but not in others!) I'm frustrated.

So, here's a summation of my code:


x = 1
y = 2
color = 3

WAIT &H3DA, 8
EraseLines (Sub that draws black lines over the old image)
DrawLines (Sub that draws the new lines of the 3D image)
FOR i = 1 to NumberOfPixels
PSET(ImageArray(i,x), ImageArray(i,y)), ImageArray(i,color)
NEXT

ImageArray is an array that has the x,y, and color of each pixel of the overlay image. That way it only draws the pixels that aren't black and saves time.

It works pretty well, but as I said, for some reason, in some areas, the wire frame image that is made in the sub DrawLines still appears over the top of the picture drawn with the FOR loop.
Is there any way to be CERTAIN that the WAIT command will wait until after the last pixel is drawn to put it to the screen?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top