Solved

Question on using 640x480x32k colors mode

Posted on 1998-02-03
3
244 Views
Last Modified: 2006-11-17
Here's my question...

For your information, I am trying to program in a 640x480x32k colors mode. Before this, I've been in 320x200x256 colors mode and I'm able to play around with the 256 colors available for me and I'm able to create a palette
with 64 different shades of a color for my needs.

But I'm new to this 640x480x32k mode and I hope that someone could answer the following doubts:

1) How many different kinds of shades can a color element
   (eg: red) have in this mode? [eg: Red can have up to 64
   different shades in 320x200x256 colors mode]

2) How can I create a palette to contain all of the shades?
   [eg: for(index=0; index<64; index++)
            write_to_palette(index, index, 0, 0);
        I can have 64 different shades of red like this.]
   
3) I understand that in 320x200x256 colors mode, the 3
   important color element are Red, Green and Blue. What
   about in 640x480x32k colors mode?
 
4) How can I use the character set from the BIOS in
   640x480x32k colors mode? Can I create the font myself
   instead of using the character set? How?  

For more informations, I'm using Turbo C++ version 3.0 for
DOS compiler. Any help offered is very much appreciated!
0
Comment
Question by:justinng
  • 2
3 Comments
 
LVL 1

Expert Comment

by:TheMadManiac
ID: 1180424
1) it depends on the card, but usually there are 5 bits for red, 5 bits for green and 5 bits for blue. this would mean that there can be 32 shades.

2) this mode does not use a palette. the 16 bits you need to write to the videomemory contain the all the color information it needs. much like in truecolor modus. Think about this: how big would a palette for 32k colors be ?

3) well, see 1. they still are red/green/blue

4) once you are in that mode, you can just use printf to write characters to the video-memory. this will take care of bios calls (which is just the same call as in textmode)
0
 

Author Comment

by:justinng
ID: 1180425
For:

1) You mean there can be 64 different shades for Red element in
   320x200x256 colors mode and only 32 different shades for the
   Red element in 640x480x32k colors mode??

2) Well... you've got a point there but how can I go about doing    that?

3) Fine.... thanx!

4) You mean using printf to write to video memory? But how?
   Like I use printf to print a string or character on the
   80x25 screen but how can I do that in 640x480x32k colors mode?
   Can I assign one of the 32k colors to the string or character?
   Sorry but can you tell me how can I go about doing it by some
   brief codes maybe?

Thanx!
0
 
LVL 1

Accepted Solution

by:
TheMadManiac earned 30 total points
ID: 1180426
1)
yes, the number of shades is reduced, but the number of colors that can be used at the same time has been increased from 256 to 32k colors. This is the cost of this modus

3)
think of the int made up out of bits:

 0 -> 4 = red
 5 -> 9 = green
 10->14 = blue

the 15th bit isn't used (it is in 64k color mode.. this is the only difference between 32k & 64k)

so, to write white, just write a in with the value 31+(31<<5)+(31<<10)

in which the first is red, the second is green and the last is blue. ( some cards use a different order of the colors in the int)

4)
printf writes to standard output device, and thus it is impossible to use colors with it (exceptions there, but do not apply for 32k color mode)
to write a character to that mode with a specified color, you probably just want to draw it yourself, with putpixels or something. this is faster as well.. i could explain it here, but that would take to much time, and it's done so many times before. besides, it's almost like putting an image on the screen.
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
ASP.net build a IF/Then Walkthrough Guide 1 211
Compile GLUT with Visual Studio 2015 1 148
I could not build boost code, 10 88
passing data from one form to another form in c++ 27 80
Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question