Antialiasing & SVGA palette problem

Antialiasing & SVGA palette problem

Post by Jari Rep » Tue, 30 Jan 2001 09:19:26



hi there !

I have some SVGA routines here to be used in my new 3d
demo. I decided to use the the 640x480  and 16-bit color mode (65536 colors)
(I think it is the 111h mode)

but I don't know how to setup the palette!!!

One thing I know is that there is a lo-color and a hi-color
and the red is 0-31, green 0-63, blue 0-31

Do I need two memory locations? If so, where the hell are these?!

So, I need help with this. Until then I will be stuck!

One more thing...

Is there any fast ways to do antialiasing of line segments ?
.

Bye/JMR

 
 
 

Antialiasing & SVGA palette problem

Post by Jerker Olofsso » Tue, 30 Jan 2001 16:34:47



> hi there !

> I have some SVGA routines here to be used in my new 3d
> demo. I decided to use the the 640x480  and 16-bit color mode (65536 colors)
> (I think it is the 111h mode)

Ever considered using DirectDraw (or similar)? :)

Quote:> but I don't know how to setup the palette!!!

>     One thing I know is that there is a lo-color and a hi-color
> and the red is 0-31, green 0-63, blue 0-31

In 16bit color there is no palette. Each pixel represent the color itself. Just
threat your backbuffer as an array of 16 bit unsigned integers.

You should also consider using 32bit graphics. It is alot easier to work with,
and it gives you more colors.. Each color channel is one byte. For 32bit RGBA,
just do a : "u32 color = red | (green<<8) | (blue<<16);"

/ Jerker

 
 
 

Antialiasing & SVGA palette problem

Post by Marcin Vorbrod » Tue, 30 Jan 2001 13:42:49


Oh man. 16 bit collor means there is no palette!

16 bit, right? so you can have:

1) 1bit empty | 5 bit red | 5 bit green | 5 bit blue
2) 5 bit red | 6 bit green | 5 bit blue

you write the color info directly into the video memory, there is NO
PALETTE.


Quote:> hi there !

> I have some SVGA routines here to be used in my new 3d
> demo. I decided to use the the 640x480  and 16-bit color mode (65536
colors)
> (I think it is the 111h mode)

> but I don't know how to setup the palette!!!

> One thing I know is that there is a lo-color and a hi-color
> and the red is 0-31, green 0-63, blue 0-31

> Do I need two memory locations? If so, where the hell are these?!

> So, I need help with this. Until then I will be stuck!

> One more thing...

> Is there any fast ways to do antialiasing of line segments ?
> .

> Bye/JMR

 
 
 

Antialiasing & SVGA palette problem

Post by Jari Rep » Wed, 31 Jan 2001 22:39:53


Thanks, you know when starting at something new, sometimes one just
doesn't have a clue....

I preffer to use the 5:6:5 color mapping. I also know how to
pack the rgb-values in a lo-byte and a hi-byte and put them
into the video memory.
The code is in my putpixel(x,y,r,g,b) routine

But I also need a getpixel(x,y,r,g,b) routine to retrieve the rgb values
from a certain point.

Is this the right method for this purpose, or is there a faster way
to do this?

,    hi = the higher byte value
,    lo = the lower byte value

,    blue = (lo && 31)
,    green = ((lo - blue)>>5) + ((hi && 7)<<3)
,    red = ((hi - green)>>3)>>3


> Oh man. 16 bit collor means there is no palette!

> 16 bit, right? so you can have:

> 1) 1bit empty | 5 bit red | 5 bit green | 5 bit blue
> 2) 5 bit red | 6 bit green | 5 bit blue

> you write the color info directly into the video memory, there is NO
> PALETTE.



> > hi there !

> > I have some SVGA routines here to be used in my new 3d
> > demo. I decided to use the the 640x480  and 16-bit color mode (65536
> colors)
> > (I think it is the 111h mode)

> > but I don't know how to setup the palette!!!

> > One thing I know is that there is a lo-color and a hi-color
> > and the red is 0-31, green 0-63, blue 0-31

> > Do I need two memory locations? If so, where the hell are these?!

> > So, I need help with this. Until then I will be stuck!

> > One more thing...

> > Is there any fast ways to do antialiasing of line segments ?
> > .

> > Bye/JMR

 
 
 

Antialiasing & SVGA palette problem

Post by Jacques De Scheppe » Wed, 31 Jan 2001 23:12:08


This seams almost right, just use & instead of && as && isn't a bitwise
operator and don't bother subtracting blue, and green. Eventually you'll
get:

blue = lo & 31;
green = (lo >> 5) + ((hi & 7) << 3); // The bits that are dropped are
red = hi >> 3;                       // forgotten, those added are 0

Just make sure hi and lo are declared as unsigned bytes, cause else right
shifting will not always add 0 to the vacant positions...


> Organization: Telia Internet

> Newsgroups: comp.graphics.algorithms
> Date: Tue, 30 Jan 2001 13:39:53 GMT
> Subject: Re: Antialiasing & SVGA palette problem

> Thanks, you know when starting at something new, sometimes one just
> doesn't have a clue....

> I preffer to use the 5:6:5 color mapping. I also know how to
> pack the rgb-values in a lo-byte and a hi-byte and put them
> into the video memory.
> The code is in my putpixel(x,y,r,g,b) routine

> But I also need a getpixel(x,y,r,g,b) routine to retrieve the rgb values
> from a certain point.

> Is this the right method for this purpose, or is there a faster way
> to do this?

> ,    hi = the higher byte value
> ,    lo = the lower byte value

> ,    blue = (lo && 31)
> ,    green = ((lo - blue)>>5) + ((hi && 7)<<3)
> ,    red = ((hi - green)>>3)>>3



>> Oh man. 16 bit collor means there is no palette!

>> 16 bit, right? so you can have:

>> 1) 1bit empty | 5 bit red | 5 bit green | 5 bit blue
>> 2) 5 bit red | 6 bit green | 5 bit blue

>> you write the color info directly into the video memory, there is NO
>> PALETTE.



>>> hi there !

>>> I have some SVGA routines here to be used in my new 3d
>>> demo. I decided to use the the 640x480  and 16-bit color mode (65536
>> colors)
>>> (I think it is the 111h mode)

>>> but I don't know how to setup the palette!!!

>>> One thing I know is that there is a lo-color and a hi-color
>>> and the red is 0-31, green 0-63, blue 0-31

>>> Do I need two memory locations? If so, where the hell are these?!

>>> So, I need help with this. Until then I will be stuck!

>>> One more thing...

>>> Is there any fast ways to do antialiasing of line segments ?
>>> .

>>> Bye/JMR

 
 
 

Antialiasing & SVGA palette problem

Post by Jari Rep » Thu, 01 Feb 2001 02:22:08


thanks a lot!

I just tested your method and it worked fine ( it was a bit faster also,
about a second for a million calcs)

I knew, I was doing something wrong, but anyway I am happy.
though I learned byte manipulation yesterday...

damm I have tried some time to figure out how this works!

"it is a bit funny when you learn new things"

/jmr



> This seams almost right, just use & instead of && as && isn't a bitwise
> operator and don't bother subtracting blue, and green. Eventually you'll
> get:

> blue = lo & 31;
> green = (lo >> 5) + ((hi & 7) << 3); // The bits that are dropped are
> red = hi >> 3;                       // forgotten, those added are 0

> Just make sure hi and lo are declared as unsigned bytes, cause else right
> shifting will not always add 0 to the vacant positions...


> > Organization: Telia Internet

> > Newsgroups: comp.graphics.algorithms
> > Date: Tue, 30 Jan 2001 13:39:53 GMT
> > Subject: Re: Antialiasing & SVGA palette problem

> > Thanks, you know when starting at something new, sometimes one just
> > doesn't have a clue....

> > I preffer to use the 5:6:5 color mapping. I also know how to
> > pack the rgb-values in a lo-byte and a hi-byte and put them
> > into the video memory.
> > The code is in my putpixel(x,y,r,g,b) routine

> > But I also need a getpixel(x,y,r,g,b) routine to retrieve the rgb values
> > from a certain point.

> > Is this the right method for this purpose, or is there a faster way
> > to do this?

> > ,    hi = the higher byte value
> > ,    lo = the lower byte value

> > ,    blue = (lo && 31)
> > ,    green = ((lo - blue)>>5) + ((hi && 7)<<3)
> > ,    red = ((hi - green)>>3)>>3



> >> Oh man. 16 bit collor means there is no palette!

> >> 16 bit, right? so you can have:

> >> 1) 1bit empty | 5 bit red | 5 bit green | 5 bit blue
> >> 2) 5 bit red | 6 bit green | 5 bit blue

> >> you write the color info directly into the video memory, there is NO
> >> PALETTE.



> >>> hi there !

> >>> I have some SVGA routines here to be used in my new 3d
> >>> demo. I decided to use the the 640x480  and 16-bit color mode (65536
> >> colors)
> >>> (I think it is the 111h mode)

> >>> but I don't know how to setup the palette!!!

> >>> One thing I know is that there is a lo-color and a hi-color
> >>> and the red is 0-31, green 0-63, blue 0-31

> >>> Do I need two memory locations? If so, where the hell are these?!

> >>> So, I need help with this. Until then I will be stuck!

> >>> One more thing...

> >>> Is there any fast ways to do antialiasing of line segments ?
> >>> .

> >>> Bye/JMR

 
 
 

1. SVGA palette problems

Why does my palette turn black when I try to set it with the VESA 2.0
interrupt? It doesn't help to manipulate the vga registers directly
either. I'm trying to do this in 800 X 600 X 256 SVGA mode.

Thanks in advance, Daniel Norman

2. I Need Your Help,I'm Cleaning My Data Base

3. Human Perspective Ratios & SVGA problems

4. Flickering Buttons

5. Palette sharing in SVGA (640x480x256)

6. TNT 2

7. 24 bit (3 x 8 bit) palette DAC on SVGA cards

8. SVGA palette manipulation

9. SVGA Modes >256 palette

10. Help needed with SVGA palette setting.

11. Problem with palettes & textboxes

12. TIFF antialiasing without antialiasing?