#include <proto/all.h>
#include <opal/opallib.h>
#include <graphics/gfxbase.h>
#include <stdio.h>
#include <stdlib.h>

#include "renderer.c"

struct GfxBase *GfxBase;

	/* external functions (int Renderer.c) */

BOOL Open_OpalScreen (ULONG Modes);
void Render_To_Opal (long Y, long Width, long Lines,
			UBYTE *Red, UBYTE *Green, UBYTE *Blue, BOOL Chunky);
void Opal_Render_Finished (void);
void Close_Opal (void);


UBYTE RedPlane[1000];
UBYTE GreenPlane[1000];
UBYTE BluePlane[1000];

void main (void)
{
   register long x,y;

	GfxBase = (struct GfxBase *) OpenLibrary ("graphics.library",0);
	if (!Open_OpalScreen (HIRES24|ILACE24|OVERSCAN24))
		{ puts  ("Can't open opalvision screeen\n");
		  exit (0);
		}
	for (y=0; y<400; y++)
		{ for (x=0; x<640; x++)
			{ RedPlane[x] = x;
			  GreenPlane[x] = 255-x;
			  BluePlane[x] = y+x;
			}
		  Render_To_Opal (y,640,1,RedPlane,GreenPlane,BluePlane,FALSE);
		}
	Opal_Render_Finished ();
	Delay (100L);
	Close_Opal ();
}

