cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/26/16:20:35

From: Shawn Hargreaves <Shawn AT talula DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: gouraud shading with allegro?
Date: Sat, 25 Jan 1997 16:15:34 +0000
Organization: None
Distribution: world
Message-ID: <bduVAEAmGj6yEwTp@talula.demon.co.uk>
References: <32E766D6 DOT 41C6 AT signal DOT dra DOT hmg DOT gb>
NNTP-Posting-Host: talula.demon.co.uk
MIME-Version: 1.0
Lines: 40
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

>I was wondering if there was a fast way to do gouraud shading using the
>functions built into allegro. I've currently got a 3D flat shading

Allegro 2.2 is going to provide gouraud shaded and texture mapped
polygon rendering functions. You can download a work-in-progress version
of this (totally unoptimised at present, but already functional) from:

        http://www.talula.demon.co/allegro/wip.html

This provides two gouraud shading modes: one which interpolates palette
colors (very fast, but requires you to have an appropriate color
gradient in your palette), and another which interpolates RGB values and
then uses a lookup table to convert the result to a paletted value.

>shading. Currently I draw a scanline using hline() so I would envisage a
>simple modification would be to replace the call to hline() with one
>that draws a line by interpolating between the colors of the line edges.

Absolutely - I have just such a function for use by my gouraud routines.
If you want to call these low-level scanline fillers directly, grab the
work-in-progress Allegro, #include "src/internal.h", and call one of the
_poly_scanline_* functions. These take three parameters: a pointer to
the video memory to be filled (you are responsible for bank switching
and for loading the bitmap selector into %fs before you call the
filler), the width of the scanline (you are responsible for clipping),
and a pointer to a POLYGON_SEGMENT structure which defines the
attributes to be interpolated. For the simple gouraud shading routine
you should set the c and dc fields, and for the RGB shader you should
set r, g, b, dr, dg, and db.

>I'm aware of the different drawing modes, do these affect hline()?

They do, but they can't do gouraud shading. Calling drawing_mode() can
set all the drawing primitives to use exclusive-or, patterned, and at
some point in the near future, translucent drawing modes.

/*
 *  Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/
 *  Ghoti: 'gh' as in 'enough', 'o' as in 'women', and 'ti' as in 'nation'.
 */

- Raw text -


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