user1930693
user1930693

Reputation: 43

New equiavalent to D3DXCOLOR Structure in Directx 11.1?

I am having trouble finding the D3DXCOLOR struct, it seems it is no longer there in DirectX 11.1 (d3d11_1.h). I have searched for an equal of it but to no luck. Can someone help me with it? Also could you tell me how to use it if it has changed a lot?

Upvotes: 4

Views: 7295

Answers (4)

sunny moon
sunny moon

Reputation: 1613

How about declaring once

using RGBA = float[4]; //c++11

or

typedef float RGBA[4]; //pre-c++11

and then using wherever needed like this

devcon->ClearRenderTargetView(backbuffer, RGBA{0.0f, 0.2f, 0.4f, 1.0f});

Upvotes: 2

alanw
alanw

Reputation: 665

Use XMCOLOR. It is located in DirectXPackedVector.h

Upvotes: 10

RelativeGames
RelativeGames

Reputation: 1593

D3DX or the DirectX Utility library has been removed, instead Microsoft wants you to use the XNA Math Library counterparts (that use SSEs & stuff, but in my case it kind of crashes sometimes so I stopped using it)

Upvotes: 0

I'm a total noob to this and i too had the problem with a sample tutorial where they used it. So after many hours searching the net. drumroll Tada....

Here is how I've converted it in my code

old code

// clear the back buffer to a deep blue
 devcon->ClearRenderTargetView(backbuffer, D3DXCOLOR{ 0.0f, 0.2f, 0.4f, 1.0f };

new code

// clear the back buffer to a deep blue
float color[4] = { 0.0f, 0.2f, 0.4f, 1.0f };
devcon->ClearRenderTargetView(backbuffer, color);

Upvotes: 10

Related Questions