Strange RGB Values

Started by
14 comments, last by Xeno 24 years ago
Why why when i Clear the viewport in D3Dim and i set some clearing color i get some strange color, i mean when i set the clear color to RGB(255,0,0) i geting a blue screen and when i set it to RGB(0,0,255) im getting a red screen, hu ??? why??

------------------------------- Goblineye Entertainment------------------------------

Advertisement
i ran into what appears to be a similar problem when i was learning about how to plot pixels. In 16 and 32 bpp color modes you can't use the RGB macro because the bits in the color value are arranged differently and have either less or more color values(something like that). Check out the programming section of gamedev there are some articles on this.

i don't know about D3D so i can't specifically help you.

Edited by - +AA_970+ on 4/16/00 8:48:09 PM
Are you using Visual Basic? If you are then use DX.CreateColorRGB instead. I think that should work.
Direct3D IM uses the D3DCOLOR data type to represent colors. You can use the D3DRGB and D3DRGBA macros to create a color for yourself.
---Ranok---
i tried the D3DRGB and D3DRGBA and with that i getting another problem , when i clear the viewport with Blue color
D3DRGB(0,0,255) i get a GREEN screen...

now this is very very strange...

somebody have good idea?

------------------------------- Goblineye Entertainment------------------------------

quote:Original post by Xeno

i tried the D3DRGB and D3DRGBA and with that i getting another problem , when i clear the viewport with Blue color
D3DRGB(0,0,255) i get a GREEN screen...

now this is very very strange...


Ever tried to look at the pixelformat of your surface?
You should write pixels in the format they are expected to be.
The macros only convert to a specific format and do not
change their behavior depending on your pixelformat.
(otherwise they would have been functions, or better,
methods of the surface object)

So if the format says something like ARGB (32 bits)
make sure you write $00ff0000 in there for red.
Also note that colors of a BMP-file are BGR data.
--- axelP
So does D3DIM RGB macro Work like BMP file???
because when i use the RGB() macro its working like u saied - BGR.

------------------------------- Goblineye Entertainment------------------------------

quote:Original post by Xeno

So does D3DIM RGB macro Work like BMP file???
because when i use the RGB() macro its working like u saied - BGR.


The macro is used to generate D3DCOLORs. Apparently
it generates pixelvalues that are equivalent to the ones
used in a BMP file.

D3DCOLORs are used for the colors of vertices and
stuff. NOT for the contents of a surface.

You have to code a conversion macro yourself for use
inside a surface.
--- axelP
Note that the RGB macro is part of the Platform SDK.
So it is used to generate Windows RGB colors, not
D3D colors... RGBA_MAKE creates D3D colors.
Confusing eh?
--- axelP
Oh, i understand now.
so i need to make function that generate values like 0xfffffff (White)
to fill my viewport color, or any surface color, and not use the RGB Macros...

am i right?

------------------------------- Goblineye Entertainment------------------------------

This topic is closed to new replies.

Advertisement