Skip to content

Line2D2Vecs constructor 'createAndSetupBuffers' not checking size when empty casuing crash in MSVC #4

@BisonLeo

Description

@BisonLeo

createAndSetupBuffers(vertDataSizeBytes, indicesDataSizeBytes,

    /* Setup Buffers */
    updateInternalData();
    int vertDataSizeBytes = internalData.size()*sizeof(internalData[0]);
    int indicesDataSizeBytes = internalIndices.size()*sizeof(internalIndices[0]);
    createAndSetupBuffers(vertDataSizeBytes, indicesDataSizeBytes,
                          &internalData[0], &internalIndices[0],
                          2*sizeof(internalData[0]));

although it compiles and runs OK under windows using GCC compiler, the code above fails in MSVC 2019 compiled executable 'movingTimeframe.exe'

I guess it should be preallocated to contain certain size? I don't know why it runs OK when compiled with g++ toolchain under windows.

The procedure to completely build using MSVC is tedious including :

  1. git clone newest freetype
    1.1 disable the following options and rebuild with MSVC
    "-DFT_DISABLE_HARFBUZZ=ON",
    "-DFT_DISABLE_PNG=ON",
    "-DFT_DISABLE_BZIP2=ON",
    "-DFT_DISABLE_BROTLI=ON"
  2. rebuild glfw using MSVC
  3. change the LIBS file names to match the built freetype and glfw libs
  4. add 'msvc_dirent.h' from https://gitcode.net/mirrors/tronkko/dirent/-/blob/master/include/dirent.h

But without doubt, this is a terrific example of OpenGL that I'm learning from. Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions