Jump to content
  • Advertisement

Archived

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

dalaptop

colors are weird

This topic is 6180 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

I have a video card that supports 16 bit color and 24 bit color (as well as the older ones I guess). Anyways, my current display mode is 800x600 24-bit color. I want my DirectX app to be the same mode. This way, no matter what mode I am in, my app will change it to 800x600 24-bit color. The problem is that CreateDevice() fails. I set up the D3DPRESENT_PARAMETERS or whatever, and fill it in with the following crap: ZeroMemory(&d3dpp, sizeof(d3dpp)); d3dpp.Windowed = FALSE; d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; d3dpp.BackBufferFormat = D3DFMT_R8G8B8; d3dpp.BackBufferWidth = 800; d3dpp.BackBufferHeight = 600; The above code should set it to 800x600 24-bit color. But when I call: hr = d3d->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hwnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &d3dd); IT FAILS! But when I rewrite part of d3dpp: d3dpp.BackBufferFormat = D3DFMT_R5G6B5 It works. It will set up in 565 16-bit color but not 24 bit color. And 24 bit color works with my card. Please help me to figure out what is wrong with this and how I can have 24-bit color.

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
simply put, your graphics card dont support 24bit in 3D mode. (most dont since it is very unoptimized way of access memory, try 32bit mode instead but be forewarned it is much slower unless you got a higher end card (geforce2+/raedon+)). Try using Directx7 instead of 8 if you are attempting simply do 2d graphics. if you card dont suport 32bit then your out of luck for anythign higher then 16bit in 3d mode.

what card do you have?

for your info dont refer to the lower color depths as the "older ones" since they are just lower color depths not older ones (granted mostof them do predate 16bit/24bit/32bit modes)

Share this post


Link to post
Share on other sites
I read somewhere (damn, can''t remember) that 24-bit color is not really true color and much slower than 16-bit or 32-bit. Might have to do with it.

Share this post


Link to post
Share on other sites
24-bit colour is true colour without an alpha channel usually. The reason it is so much slower is that 3 bytes is an unusual number for a piece of data. Most hardware is optimised for even numbers of bytes, usually 4.


--------------------

Never eat anything bigger than your own head.

Share this post


Link to post
Share on other sites
It must be that my card supports 24 bit in 2D mode and not 3D. It doesn''t support 32 bit at all. It''s some cheap card that came with the computer, it''s from Intel! That''s pretty sad. I have no choice but to result to 16 bit I guess. There is 565 and 555 right? Is there anything I need to know about setting up the right one or anything? Doesn''t 16 bit have about 65,000 colors? Thanks a lot for the help guys.

~Andrew Clark

Share this post


Link to post
Share on other sites
You said you''re video card supports 24-bit processing, so try creating the device with full hardware support, using D3DCREATE_HARDWARE_VERTEXPROCESSING instead of D3DCREATE_SOFTWARE_VERTEXPROCESSING like you are using in the code you gave above. This should help, because I know when I set my colour to 32-bit, i need to use hardware processing.

Share this post


Link to post
Share on other sites
Try the following :-
  
if( Windowed )
{
// must use current display format,

// warning don''t call if in fullscreen mode otherwise you will

// get that format!

D3DDISPLAYMODE DisplayInfo;
util_zero( DisplayInfo );
DX8->GetAdapterDisplayMode( D3DADAPTER_DEFAULT, &DisplayInfo );
return( DisplayInfo.Format ); // use this format

}
else
{
// fullscreen so search for mode that will work

////////////////////////////////////////////////

// display format finder

static D3DFORMAT FSFmtList[]=
{
D3DFMT_R8G8B8 ,
D3DFMT_A8R8G8B8,
D3DFMT_X8R8G8B8,
D3DFMT_X1R5G5B5,
D3DFMT_R5G6B5 ,
D3DFMT_A1R5G5B5,
D3DFMT_A4R4G4B4,
};

for( u16 i=0;i<sizeof(FSFmtList) / sizeof(D3DFORMAT); i++ )
{
if( SUCCEEDED( DX8->CheckDeviceType( D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,FSFmtList[i],FSFmtList[i],FALSE)) )
return( FSFmtList[i] ); // Use this format

}
}


Note if you want to run in 16 bit mode the for loop should start at 3 (D3DFMT_X1R5G5B5), not 0.

Hope this helps.

[The views stated herein do not necessarily represent the view of the company Eurocom ]

Eurocom Entertainment Software
www.Eurocom.co.uk

The Jackal

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!