forums

TNT Basic Forums > Bugs!
Seemingly Random Color Problems
< Last Thread     Next Thread >
Author
Thread        Post A Reply

11-10-2002 22:53

Posted by:
CubeFusion

Click Here to Email CubeFusion   Find more posts by CubeFusion

I decided to do the Pong tutorial, and ended up stumbling on a few color related errors.

While I was using software mode, All of the red on the screen was missing. The ball was also only half drawn in white, the other half was either black or never drawn in the first place.

Then when I used hardware mode, The color on both paddles had came back, but all of the white on them was now gone. The ball was drawn "almost" correctly, it was missing a good 20% off the right side of it.

I thought it might have been user error, so I copied out the source code on the tutorial page and still had the exact same problems.

I wrote this program to test out how accurate the colors were. The tasks it does are...

*Set up the screen for software mode
*Create a pure Red color from components
*Test out both the default red, and my component red
*Switch to hardware mode
*Run the previous tests again

The first test was my component red, it passed because it succesfully painted the screen red.

When it tried to paint the screen the default red, the screen was just painted black.

The same test was run in hardware mode during the second phase, my component red was now showing up as green. The default red then showed up correctly.

I tested these out on both OS 10.2 and 9.2.2, the results were the same for both. Here is my current setup.

iMac G3 500mhz
256 MB of memory
Rage 128 Pro

This is the source code my tests used.
------------------------------------------
int horizontal=640,vertical=480
int NewColor

graphics mode horizontal,vertical
hide mouse

NewColor = set green component (NewColor,0)
NewColor = set red component (NewColor,255)
NewColor = set blue component (NewColor,0)

' Component Test
set pen color NewColor
paint canvas
draw frame

wait mouse down
wait mouse up

' Default Test
set pen color Red
paint canvas
draw frame

wait mouse down
wait mouse up

graphics mode hardware horizontal,vertical

' Component Test
set pen color NewColor
paint canvas
draw frame

wait mouse down
wait mouse up

' Default Test
set pen color Red
paint canvas
draw frame

wait mouse down
wait mouse up
------------------------------------------

11-11-2002 06:59

Posted by:
John Treece-Birch

Find more posts by John Treece-Birch

Hardware Mode

This happens because hardware mode uses 24-bit colour and software mode uses 16-bit colour. If you make a colour outside of hardware mode then it will be a 16-bit colour, if you then pass it to a function during hardware mode it will be expecting a 24-bit colour.

Basically, if you are going to use switch between hardware mode and software mode (which you shouldn't ever need to do) then re make all your colours again.

Thanks,
John

11-13-2002 22:51

Posted by:
CubeFusion

Find more posts by CubeFusion

I'll make sure not to switch between software and hardware mode while running my game. Thanks you for taking the time to answer my post.

All times are GMT        Post A Reply

Forum Jump:
< Last Thread     Next Thread >

< Contact Us - TNT Basic >

Powered by: vBulletin Lite Version 1.0.1 Lite
Copyright © Jelsoft Enterprises Limited 2000.