delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/01/30/17:48:42

From: "Sven A. Havemann" <havemann AT uran DOT informatik DOT uni-bonn DOT de>
Date: Mon, 30 Jan 1995 18:44:42 +0100
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: True Color Graphics Possible?
Cc: havemann AT uran DOT informatik DOT uni-bonn DOT de

Hi - Does anybody know how to display true color?
=================================================

I have a Miro Crystal 8S VESA-S3 card capable of showing 640x480x24bit true
color. - Still, though, I didn't manage to display them from gcc/djgpp even
when using djgpp 2.6.0m1, with

set GO32=driver d:/.../vesadrv.vdr::pf gw 640 gh 480 nc 16777216

Questions:
- Is this and the following program otherwise correct? - (the slashed out
  version works fine using high-color rgb15 instead of rgb24)
- Should I try 2.6.0m3 or 2.6.3 instead? Would that help?
- Is there a future release of libgrx which works correctly? One with
  long-values for colors instead of making use of the fact that for gcc
  int-values have four bytes instead of two?
- Why would testvesa or so, or modetest, find out correctly the possible
  driver modes including 640x480x24, but when invoking it with the following
  program I always get 'Unknown adapter type in driver...'- ???
- Is it maybe a memory mapping problem???
- THERE ARE FREEWARE PROGRAMS WHICH SHOW TRUE COLOR ON MY CARD EVEN WITHOUT
  CONFIGURING! (.gif viewer svga112.zip - how did they write it?)

                                  Thanx for any reply! - Your's, Sven.


============= PROGRAM =======================================================
#include <grx.h>
#include <iostream.h>

int rgb15(float r, float g, float b)
{  return ((int(r*32))<<10) | ((int(g*32))<<5) | (int(b*32));  }

int rgb24(float r, float g, float b)
{  return ((int(r*256))<<16) | ((int(g*256))<<8) | (int(b*256));  }

int main()
{
   float x0=0,   y0=0,   u,v,w;
   float x1=320, y1=480;
   float x2=639, y2=0;

//   GrSetMode(GR_width_height_color_graphics,640,480,32768);
   GrSetMode(GR_width_height_color_graphics,640,480,16777216);

   for(u=0.0; u<1.0; u+=0.001)
   for(v=0.0; v<1.0-u; v+=0.001) {
      w=1.0-u-v;
      GrPlot(int(u*x0+v*x1+w*x2),int(u*y0+v*y1+w*y2),rgb24(u,v,w));
   }

   char c; cin >> c;
   GrSetMode(GR_default_text);
   return 0;
}
============= PROGRAM =======================================================


- Raw text -


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