Hazel game engine (023-025) pre-render preparation discussion and maintenance

If there are errors in the code, terminology, etc. in the text, please correct me

023. Introduction to Rendering

  1. A renderer basically refers to our ability to draw graphics on the screen

    Fidelity, simulating the real world

  2. GPU is used to calculate graphics pixels in parallel

  3. Interacting with the GPU requires a graphics interface API, OpenGl is one of them

  4. OpenGL is simpler

024. Rendering architecture

In a word: encapsulate the rendering graphics API with abstract classes


025. Render maintenance

ImGui cannot find the function definition to solve

  • reason

    ImGui is statically linked to Hazel.dll, but Hazel.dll has the ability to delete the function definition content that is not exported in ImGui, so if the content of ImGui is used in the exe file of the linked dll file, the link error will occur.

    But the difference: ImGui.lib is statically linked to Hazel, and Hazel itself can directly use the functions of ImGui (you don't need to export the function definition of ImGui to Hazel to use it).

  • Solution 1

    Use a .def module definition file that lists all the functions we want to export from ImGui

    But the disadvantage is that it is very troublesome

  • Solution 2

    There is a macro definition in front of the function of ImGui, but it is empty

    Please add a picture description

    The Hazel project redefines this empty macro definition as dll export , and the sandbox project redefines this macro definition as dll import

    • Hazel

      IMGUI_API=__declspec(dllexport);

    • sandbox

      IMGUI_API=__declspec(dllimport);

    Note = there can be no spaces around IMGUI_API = __declspec(dllimport); (wrong wording)

    (Tested: It doesn't matter if the Hazel project does not redefine this macro as an export, just sandbox import, the test is wrong)

  • Effect

    Please add a picture description

Discussion: Whether the Hazel project should be changed to a static lib

  • dll

    • advantage
      • Hot update, after changing the engine code, you only need to recompile the dll, so that multiple test projects can use the latest engine code without recompilation
      • Make linking easier for clients
    • shortcoming
      • dll many warnings
      • exe dynamic link dll starts slowly
  • lib

    All links are built into the exe file

It is necessary to consider the advantages of dll. From the perspective of using the engine, the engine code has been completed and there is no need for hot update. The advantage of hot update of dll is gone.

Guess you like

Origin blog.csdn.net/qq_34060370/article/details/131388707