The recommended MFC way is to create a control member variable (of the type CStatic or any derived from CStatic class) for this picture control. Then you will be able use all the methods of this class.
I am a hobbyist developer and I am recycling myself with the intention of learning C++ and D3D11. To give you an idea, I have been using for more than a decade a D3D9 engine with a programming language very similar to C. After doing several D3D11 tutorials, I think I understand fairly well where the shots are going.
The thing is that these tutorials lack an architecture designed to be scaled and they all end up in a function that does everything at once. Reading around, I have found a small explanation of how to combine in a simple way all the buffers that have to be associated to the pipeline to end up drawing on the screen, but I can't make it work.
The system is based on a class called 'Bindable' that contains a virtual function to associate the buffers to the pipeline and that is configured to be 'friendly' to the class that initializes the graphics (Graphics) to be able to access its private members.
I expand this class for each type of buffer with its specific constructor and dinder. For example, the mesh index buffer, which contains a pointer to the buffer and the number of indexes, looks like this:
As a test method, I create instances of the 'Bindable' heir classes and save their index in order to associate their buffers in subsequent frames. All in the same function, by the moment.
if (m_ibufIndex < 0)
m_ibufIndex = AddBind(std::make_unique<IndexBuffer>(*this, _indices));
This way, I intend to be able to associate all the buffers for each actor in the scene by means of a list of indexes and thus also be able to reuse the same buffers in different actors, although I haven't written this part yet, as I have found that the buffers are not associated to the pipeline correctly. When I call 'ID3D11DeviceContext::DrawIndexed' I get a warning that says the following:
ID3D11DeviceContext::DrawIndexed: An Index Buffer is expected, but none is bound. This is OK, as reading from a missing Index Buffer is defined to return 0. However the developer probably did not intend to make use of this behavior.
The thing is that the code compiles without problems and I have been able to verify, with the invaluable help of ImGui, that the instances of 'Bindable' are certainly created and that the buffers exist. For this purpose, I have added a member to the 'IndexBuffer' class that returns the description of the buffer and that I check right after the 'Bindable' creation/association block and it certainly exists.
I have tried to reinterpret the pointers hosted in 'm_binds' to their corresponding class, although I am pretty sure that it is not necessary.
You should really check the return values when creating buffers - you might find the graphics card doesn't want to create a 16-bit buffer or something annoying like that. Direct3D11 will happily run though a load of code that does nothing because something at the start wasn't set up properly.
I would step through in the debugger and check that everything is being assigned, and especially that the index buffer is being set to a real value and not nullptr.
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.
I wanna implement an algorithm for Facial Recognition in C++ with the help of Viola-Jones, aka Adaboost, but without using OpenCV or any other similar library. I wanna do it all from scratch. Any tips?
Everybody gives me ambiguous answers.
P.S.: I started the whole thing by creating a RGB to grayscale Bitmap conversion.