I am currently trying to learn DirectX 11 using C++ in Visual Studio 2017 and have run into a problem.
#include <Windows.h>
#include <windowsx.h>
#include <d3d11.h>
#include <d3d12.h>
#include <d3dcompiler.h>
// include D3D Librararies
#pragma comment (lib, "d3d11.lib")
#pragma comment (lib, "d3d12.lib")
#pragma comment (lib, "D3DCompiler.lib")
// Definitions
#define SCREEN_WIDTH 800
#define SCREEN_HEIGHT 600
// Global Declarations
IDXGISwapChain *swapchain; // Pointer to Swap Chain Buffer
ID3D11DeviceContext *devcon; // Pointer to managing Device for GPU
ID3D11Device *dev; // Pointer to GPU
ID3D11RenderTargetView *backBuffer; // A pointer to an object that holds info about the render target
ID3D11VertexShader *pVS; // The Vertex shader
ID3D11PixelShader *pPS; // The Pixel Shader
struct VERTEX {
FLOAT X, Y, Z; // Position
D3DCOLORVALUE Color; // Color
};
// float color2[4] = { 1.0f, 0.0f, 0.0f, 1.0f };
VERTEX OurVertex = { 0.0f, 0.5f, 0.0f, D3DCOLORVALUE(1.0f, 0.0f, 0.0f, 1.0f)}; // No suitable constructor exists to convert from "float" to "_D3DCOLORVALUE"
There is an error inside of OurVertex, where C++ can't seem to convert the float numbers in D3DCOLORVALUE() into a D3DCOLORVALUE item. I tried looking at other solutions, and couldn't find any to solve my case.
Is there a solution to this?