Example #1
0
int GGI_vgagl_drawpixel(struct ggi_visual *vis, int x, int y)
{
	CHECKXY(vis, x, y);
	
	gl_setpixel(x, y, LIBGGI_GC_FGCOLOR(vis));

	return 0;
}
Example #2
0
int GGI_vgagl_putpixel(struct ggi_visual *vis, int x, int y, ggi_pixel col)
{ 
	CHECKXY(vis, x, y);

	gl_setpixel(x, y, col);

	return 0;
}
Example #3
0
void glfx_pattern4(UNS_32 *offset, const INT_8 *sintable, UNS_16 sinlen)
{
  UNS_16 x,y;

  for (x=0;x<GL_XSIZE*GL_XBOARD;x++)
    for (y=0;y<GL_YSIZE*GL_YBOARD;y++) {
      gl_point p = {x,y};
      gl_col c = {4*abs(sintable[(*offset+y)%sinlen]), 1*abs(sintable[(*offset+y)%sinlen])};
      gl_setpixel(&p,&c);
    }
}
Example #4
0
int GGI_vgagl_putpixel_nc(struct ggi_visual *vis, int x, int y, ggi_pixel col)
{ 
	gl_setpixel(x, y, col);

	return 0;
}
Example #5
0
int GGI_vgagl_drawpixel_nc(struct ggi_visual *vis, int x, int y)
{
	gl_setpixel(x, y, LIBGGI_GC_FGCOLOR(vis));

	return 0;
}
Example #6
0
int main() {
   int maxCols = 1024;
   int maxRows = 768;
   int maxIterations = 2048;
   int maxSize = 4;
   float Xmin = -2.0;
   float Xmax = 1.2;
   float Ymin = -1.2;
   float Ymax = 1.2;
 
   double X, Y;
   double Xsquare, Ysquare;
   double currentP;
   double currentQ[767];
   double deltaP, deltaQ;
   int color;
   int currentRow, currentCol;
 
   deltaP = (Xmax - Xmin)/(double)maxCols;
 
   deltaQ = (Ymax - Ymin)/(double)maxRows;
 
   currentQ[0] = Ymax;
   for (currentRow = 1; currentRow < maxRows; currentRow++) {
      currentQ[currentRow] = currentQ[currentRow-1] - deltaQ;
   }
   currentP = Xmin;
 
   vga_init();
   vga_setmode(G1024x768x256);
   gl_setcontextvga(G1024x768x256);
   physicalscreen = gl_allocatecontext();
   gl_getcontext(physicalscreen);
   gl_setcontextvgavirtual(G1024x768x256);
   virtualscreen = gl_allocatecontext();
   gl_getcontext(virtualscreen);
   gl_setcontext(virtualscreen);
 
   for (currentCol = 0; currentCol < maxCols; currentCol++) {
      for (currentRow = 0; currentRow < maxRows; currentRow++) {
         X = 0.0;
         Y = 0.0;
         Xsquare = 0.0;
         Ysquare = 0.0;
         color = 0;
         while ((color <= maxIterations) && (Xsquare + Ysquare <= maxSize)) {
            Xsquare = X * X;
            Ysquare = Y * Y;
            Y = (2*X*Y) + currentQ[currentRow];
            X = (Xsquare - Ysquare) + currentP;
            color++;
         }
             gl_setpixel(currentCol, currentRow, color % 256);
      }
      currentP = currentP + deltaP;
      gl_copyscreen(physicalscreen);
   }
   vga_getch();
   gl_clearscreen(0);
   vga_setmode(TEXT);
 
   return 0;
}
void test(void)
{
    int i, j;
    unsigned char *bitmap;
    GraphicsContext *savedcontext;

    if (VIRTUAL)
	gl_setcontext(backscreen);

    gl_clearscreen(0);
    for (i = 0; i < 5; i++) {
	gl_clearscreen(0);
	for (j = 0; j < 20000; j++)
	    gl_setpixel(random() % WIDTH, random() % HEIGHT,
			random() % COLORS);
    }

    if (VIRTUAL)
	gl_copyscreen(physicalscreen);

    gl_clearscreen(0);
    for (i = 0; i < 5000; i++) {
	int x, y;
	x = random() % (WIDTH - 1);
	y = random() % (HEIGHT - 1);
	gl_fillbox(x, y, random() % (WIDTH - x), random()
		   % (HEIGHT - y), random() % COLORS);
    }

    if (VIRTUAL)
	gl_copyscreen(physicalscreen);

    gl_clearscreen(0);
    for (i = 0; i < 4000; i++)
	gl_line(random() % WIDTH, random() % HEIGHT,
		random() % WIDTH, random() % HEIGHT,
		random() % COLORS);

    if (VIRTUAL)
	gl_copyscreen(physicalscreen);

    /* Create bitmap. */
    bitmap = malloc(64 * 64 * BYTESPERPIXEL);
    /* Create temporary graphics context to create bitmap in. */
    savedcontext = gl_allocatecontext();
    gl_getcontext(savedcontext);
    gl_setcontextvirtual(64, 64, BYTESPERPIXEL, BITSPERPIXEL, bitmap);
    /* The rgb functions can be used to create nice bitmaps easily for */
    /* hicolor/truecolor modes. The 256 color 'emulated' truecolor */
    /* looks less impressive. */
    for (i = 0; i < 32; i++)
	for (j = 0; j < 32; j++) {
	    int c;
	    c = 255 - (i + j) * 4;
	    gl_setpixelrgb(31 - i, 31 - j, c, 0, 0);
	    gl_setpixelrgb(32 + i, 31 - j, c, c, 0);
	    gl_setpixelrgb(31 - i, 32 + j, c, 0, c);
	    gl_setpixelrgb(32 + i, 32 + j, c, c, c);
	}
    /* Restore previous context. */
    gl_setcontext(savedcontext);

    gl_clearscreen(0);
    for (i = 0; i < 4000; i++) {
	int x, y;
	x = random() % (WIDTH - 64 + 1);
	y = random() % (HEIGHT - 64 + 1);
	gl_putbox(x, y, 64, 64, bitmap);
    }

    free(bitmap);

    if (VIRTUAL)
	gl_copyscreen(physicalscreen);
}