Click here to Skip to main content
14,663,253 members
Home » Discussions » C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: basic MFC app Pin
CalinNegru(fearless_)9-Apr-20 0:28
MemberCalinNegru(fearless_)9-Apr-20 0:28 
Questionplease help me find the error guys, they said expected unqualified-id before '{' token at line 11, col 19.. Pin
Salsabilatikah Yunus5-Apr-20 9:08
MemberSalsabilatikah Yunus5-Apr-20 9:08 
AnswerRe: please help me find the error guys, they said expected unqualified-id before '{' token at line 11, col 19.. Pin
Victor Nijegorodov5-Apr-20 9:15
MemberVictor Nijegorodov5-Apr-20 9:15 
AnswerRe: please help me find the error guys, they said expected unqualified-id before '{' token at line 11, col 19.. Pin
k50545-Apr-20 9:27
mvek50545-Apr-20 9:27 
QuestionRe: please help me find the error guys, they said expected unqualified-id before '{' token at line 11, col 19.. Pin
David Crow6-Apr-20 4:03
MemberDavid Crow6-Apr-20 4:03 
Question[SOLVED]Problems when trying to abstract D3D11 types in a class with C++ Pin
txesmi4-Apr-20 0:07
Membertxesmi4-Apr-20 0:07 
AnswerRe: Problems when trying to abstract D3D11 types in a class with C++ Pin
Graham Breach4-Apr-20 1:47
MemberGraham Breach4-Apr-20 1:47 
GeneralRe: Problems when trying to abstract D3D11 types in a class with C++ Pin
txesmi4-Apr-20 3:11
Membertxesmi4-Apr-20 3:11 
Thank you for your answer, Graham.

I actually do check all the returns, I just squeezed down the code to the minimum. Even I check the data from gdiplus.h, that's where the warning come from. Every D3D11 function call is wrapped into an exception thrower.

I already have a straight function where the buffers are created and released every frame that works. I am trying to replace all those creations, step by step, by preloaded buffers, but with no luck.

To be clearer, I am trying to sustitute index and vertex buffers creations by the corresponding classes from a function that already draws a rotating cube. The mesh description is the very same.

```
// Vertex buffer description
wrl::ComPtr<ID3D11Buffer> _vertexBuf;
D3D11_BUFFER_DESC _vbd = {};
_vbd.BindFlags = D3D11_BIND_VERTEX_BUFFER;
_vbd.Usage = D3D11_USAGE_DEFAULT;
_vbd.CPUAccessFlags = 0u;
_vbd.MiscFlags = 0u;
_vbd.ByteWidth = sizeof(_vertices);
_vbd.StructureByteStride = sizeof(Vertex);

D3D11_SUBRESOURCE_DATA _vsd = {};
_vsd.pSysMem = _vertices;

// Create vertex buffer
GFX_THROW_INFO(_hr,
    mp_device->CreateBuffer(&_vbd, &_vsd, &_vertexBuf)
);

// Bind vertex buffer to pipeline
const UINT _stride = sizeof(Vertex);
const UINT _offset = 0u;
GFX_THROW_INFO_ONLY(_v,
    mp_context->IASetVertexBuffers(
        0u,
        1u,
        _vertexBuf.GetAddressOf(),
        &_stride,
        &_offset
    )
);


// Index buffer description
wrl::ComPtr<ID3D11Buffer> _indexBuf;
D3D11_BUFFER_DESC _ibd = {};
_ibd.BindFlags = D3D11_BIND_INDEX_BUFFER;
_ibd.Usage = D3D11_USAGE_DEFAULT;
_ibd.CPUAccessFlags = 0u;
_ibd.MiscFlags = 0u;
_ibd.ByteWidth = sizeof(_indices);
_ibd.StructureByteStride = sizeof(unsigned short);

D3D11_SUBRESOURCE_DATA _isd = {};
_isd.pSysMem = _indices;

// Create index buffer
GFX_THROW_INFO(_hr,
    mp_device->CreateBuffer(&_ibd, &_isd, &_indexBuf)
);

// Bind index buffer to pipeline
GFX_THROW_INFO_ONLY(_v,
    mp_context->IASetIndexBuffer(
        _indexBuf.Get(),
        DXGI_FORMAT_R16_UINT,
        0u
    )
);


I intend to replace the top with the bottom

if (m_indexCount == 0) {
    // temporary, just a build of vectors from local arrays
    std::vector<Vertex> _verts;
    for (int _i = 0; _i < 8; _i += 1)
        _verts.push_back(_vertices[_i]);
    std::vector<unsigned short> _inds;
    for (int _i = 0; _i < 36; _i += 1)
        _inds.push_back(_indices[_i]);


    m_indexCount = _inds.size();
    m_ibufIndex = AddBind(std::make_unique<IndexBuffer>(*this, _inds));
    m_vbufIndex = AddBind(std::make_unique<VertexBuffer>(*this, _verts));

} else {
    ((IndexBuffer*)(m_binds[m_ibufIndex].get()))->Bind(*this);
    ((VertexBuffer*)(m_binds[m_vbufIndex].get()))->Bind(*this);
}

GeneralRe: Problems when trying to abstract D3D11 types in a class with C++ Pin
Graham Breach4-Apr-20 4:16
MemberGraham Breach4-Apr-20 4:16 
GeneralRe: Problems when trying to abstract D3D11 types in a class with C++ Pin
txesmi4-Apr-20 4:54
Membertxesmi4-Apr-20 4:54 
QuestionFacial Recognition in C++, from scratch Pin
Ana Gheorghiță3-Apr-20 0:58
MemberAna Gheorghiță3-Apr-20 0:58 
AnswerRe: Facial Recognition in C++, from scratch Pin
Richard MacCutchan3-Apr-20 1:59
mveRichard MacCutchan3-Apr-20 1:59 
AnswerRe: Facial Recognition in C++, from scratch Pin
_Flaviu5-Apr-20 0:42
Member_Flaviu5-Apr-20 0:42 
Questioninverse sinus, floats Pin
CalinNegru(fearless_)2-Apr-20 21:25
MemberCalinNegru(fearless_)2-Apr-20 21:25 
AnswerRe: inverse sinus, floats Pin
Richard MacCutchan2-Apr-20 21:35
mveRichard MacCutchan2-Apr-20 21:35 
GeneralRe: inverse sinus, floats Pin
CalinNegru(fearless_)2-Apr-20 21:53
MemberCalinNegru(fearless_)2-Apr-20 21:53 
AnswerRe: inverse sinus, floats Pin
CPallini2-Apr-20 21:57
mveCPallini2-Apr-20 21:57 
GeneralRe: inverse sinus, floats Pin
CalinNegru(fearless_)2-Apr-20 23:01
MemberCalinNegru(fearless_)2-Apr-20 23:01 
GeneralRe: inverse sinus, floats Pin
CPallini2-Apr-20 23:18
mveCPallini2-Apr-20 23:18 
GeneralRe: inverse sinus, floats Pin
CalinNegru(fearless_)2-Apr-20 23:36
MemberCalinNegru(fearless_)2-Apr-20 23:36 
GeneralRe: inverse sinus, floats Pin
CPallini3-Apr-20 2:17
mveCPallini3-Apr-20 2:17 
GeneralRe: inverse sinus, floats Pin
Victor Nijegorodov2-Apr-20 23:39
MemberVictor Nijegorodov2-Apr-20 23:39 
GeneralRe: inverse sinus, floats Pin
CalinNegru(fearless_)3-Apr-20 0:02
MemberCalinNegru(fearless_)3-Apr-20 0:02 
GeneralRe: inverse sinus, floats Pin
CalinNegru(fearless_)6-Apr-20 5:53
MemberCalinNegru(fearless_)6-Apr-20 5:53 
GeneralRe: inverse sinus, floats Pin
CPallini6-Apr-20 11:12
mveCPallini6-Apr-20 11:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.