Skip to content

[DEV BUG] Sprites not rendering #928

@kholbrook1303

Description

@kholbrook1303

Please confirm the following points:

  • This report is NOT about the Android apps in the Play Store
  • I have searched the project page to check if the issue was already reported

Affected Project

libprojectM (including the playlist library)

Affected Version

4.2 (latest master)

Operating Systems and Architectures

All

Build Tools

Build Tool: CMake

Additional Project, OS and Toolset Details

Visual Studio 2022; Observed on Windows and Linux

Type of Defect

Graphical issue (rendering glitches, no or broken rendering result)

Log Output

Describe the Issue

There are 2 issues causing sprites not to appear.

Issue 1: #911 on line TextureManager::LoadTexture, height and width is never set since changing to latest SOIL2 lib due to SOIL_load_OGL_texture not supporting width/height. I did some logging and found that in MilkdropSprite::Init when the texture is loaded, the resulting width/height is 0x0.

Not sure the best method is for this one. glGetTexLevelParameteriv to obtain width / height after loading the image doesn't work on GLES. SOIL_load_image does support width/height but to avoid loading the image twice there would be allot to change to match what SOIL_load_OGL_texture does under the hood.

I am currently calling SOIL_load_image to get the width/height, SOIL_free_image_data, then SOIL_load_OGL_texture. I do realize loading the image twice isn't the best method, I am just not positive the best way forward.

Issue 2:
Mesh class has changed glDrawArrays to glDrawElements, defaulting with primitive type LINES. But 'SetRenderPrimitiveType' is never called from MilkdropSprite::MilkdropSprite to set the primitive type to TRIANGLE_STRIP.

Quick fix:

MilkdropSprite::MilkdropSprite()
    : m_mesh(Renderer::VertexBufferUsage::DynamicDraw, false, true)
{
    m_mesh.SetVertexCount(4);
    m_mesh.SetRenderPrimitiveType(Renderer::Mesh::PrimitiveType::TriangleStrip); // Set to triangle strip for quad rendering.
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThe issue is (potentially) a bug.

    Type

    Projects

    Status

    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions