#The screen do not open.

2 messages · Page 1 of 1 (latest)

sullen oyster
#

when i implemented the light function and material funtion. The screen do not open anymore. i find the constentBuffer_matreal becoming zero and i do not understand why ```c++ struct ML { // material
struct ML { // material
float Diffuse[3];
float Ambient[3];
float Specular[3];
float Emissive[3];
float Power;
};

bool material(ID3D11Device* device, ID3D11Buffer*& constentBuffer_matreal) {
ML MATREAL;
MATREAL.Diffuse[0] = 0.0f;
MATREAL.Diffuse[1] = 0.0f;
MATREAL.Diffuse[2] = 0.0f;

MATREAL.Ambient[0] = 0.0f;
MATREAL.Ambient[1] = 0.0f;
MATREAL.Ambient[2] = 0.0f;

MATREAL.Specular[0] = 0.0f;
MATREAL.Specular[1] = 0.0f;
MATREAL.Specular[2] = 0.0f;

MATREAL.Emissive[0] = 0.0f;
MATREAL.Emissive[1] = 0.0f;
MATREAL.Emissive[2] = 0.0f;

MATREAL.Power = 50.0f;

D3D11_BUFFER_DESC BufferDesc_matrix;
BufferDesc_matrix.ByteWidth = sizeof(ML);
BufferDesc_matrix.Usage = D3D11_USAGE_IMMUTABLE;
BufferDesc_matrix.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
BufferDesc_matrix.CPUAccessFlags = 0;
BufferDesc_matrix.MiscFlags = 0;
BufferDesc_matrix.StructureByteStride = 0;

D3D11_SUBRESOURCE_DATA data_1;
data_1.pSysMem = &MATREAL;
data_1.SysMemPitch = 0;
data_1.SysMemSlicePitch = 0;

HRESULT hr = device->CreateBuffer(&BufferDesc_matrix, &data_1, &constentBuffer_matreal);
return !FAILED(hr);

}

quaint narwhalBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.