DrawTexture related crashes

  • Has something changed related to BaseDraw::DrawTexture in R23?

    I am trying to port my plugins (working fine in R16 .. R21). But each time I perform a DrawTexture I get a crash in c4dplugin.
    The crash does not happen at the time of performing the call but somewhere afterwards.

    Other BaseDraw drawing methods like DrawPolygon, DrawLine, DrawPointArray, etc ... are working fine.

    Forgot to mention this drawing happens in context of SceneHook::Draw. During the draw-pass.

  • Did some further searches and seems I can resolve the issue by using:

    bd->DrawTexture(bitmap, positions, nullptr, nullptr, uvcoords, 4, DRAW_ALPHA::NORMAL, DRAW_TEXTUREFLAGS::INTERPOLATION_NEAREST | DRAW_TEXTUREFLAGS::TEMPORARY);

    whereas I had used DRAW_TEXTUREFLAGS::NONE in the past.

  • Hi As the documentation state since S22, DrawTexture doesn't copy in every situation the BaseBitmap (which is way more efficient). However, that implies either you ensure the basebitmap is allocated and alive as long as it is displayed or you pass the flag DRAW_TEXTUREFLAGS::TEMPORARY so a copy is done internally and you are safe :)

    Hope this help.

  • @m_adam Thanks for that extra info.
    I had done a search in the documentation regarding DrawTexture but didn't see it listed in the API changes. Hence, I didn't expect its behaviour to have changed so drastically.
    I haven't worked with S22 nor R23 before, so I didn't look in detail about the DrawTexture documentation, since it wasn't listed as changed.

    May I encourage this to be added in API Changes ... as it is quite a big deal encountering this issue when all worked fine in R16 upto R21.