Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Xeno

Strange RGB Values

This topic is 6699 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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??

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Are you using Visual Basic? If you are then use DX.CreateColorRGB instead. I think that should work.

Share this post


Link to post
Share on other sites
Direct3D IM uses the D3DCOLOR data type to represent colors. You can use the D3DRGB and D3DRGBA macros to create a color for yourself.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
So does D3DIM RGB macro Work like BMP file???
because when i use the RGB() macro its working like u saied - BGR.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!