raysan5 / raygui

A simple and easy-to-use immediate-mode gui library
zlib License
3.58k stars 304 forks source link

Missing pixels on `DrawCircleV()` only with raygui #440

Open timtro opened 1 week ago

timtro commented 1 week ago

In the following image, you will note that the circles (drawn with DrawCircleV) seem to be missing pixels.

Screenshot from 2024-11-10 11-32-58

I am aware of the raylib issue #3247, but I don' think this is related because the problem wasn't there until I added the GUI elements, and goes away when I comment them out. See my main function below.

int main(void) {
  SetConfigFlags(FLAG_WINDOW_MAXIMIZED | FLAG_WINDOW_RESIZABLE
                 | FLAG_MSAA_4X_HINT);

  InitWindow(1920, 1080, "Spline Playground");
  SetTargetFPS(120);

  AppState app = []() {
    AppState s;
    s.cam = Camera2D{.offset =
                         Vector2(GetScreenWidth() / 2., GetScreenHeight() / 2.),
                     .target = Vector2(0, 0),
                     .rotation = 0,
                     .zoom = 50};
    return s;
  }();

  while (!WindowShouldClose()) {
    BeginDrawing();
    BeginMode2D(app.cam);
    ClearBackground(RAYWHITE);
    app.update_mouse_coordinates();
    app.update_camera();
    app.focused_point = std::nullopt;

    app.draw_2d_fullscreen_grid();
    app.draw_fps();
    app.draw_spline_points();

    // … input handling and state logic to determine what is drawn
    // …
    // …

    EndMode2D();

    // Problem goes away if I comment out the `GuiCheckBox`s.
    GuiCheckBox((Rectangle){12, 62, 20, 20}, "Draw Velocity Vectors",
                &app.draw_velocity);
    GuiCheckBox((Rectangle){12, 60 + 25, 20, 20}, "Draw Acceleration Vectors",
                &app.draw_acceleration);
    GuiCheckBox((Rectangle){12, 60 + 50, 20, 20}, "Draw Curvature Cone",
                &app.draw_curvature_comb);

    EndDrawing();
  }

  CloseWindow();  // Close window and OpenGL context

  return 0;
}

This may well be a mistake I'm making and not a bug. Apologies in advance if it is my fault.

raysan5 commented 6 days ago

@timtro did you try removing FLAG_MSAA_4X_HINT? I think issue could be related to it and unfortunately mostly dependant on GPU/drivers, so, very difficult to address... An alternative solution is using a texture with a circle.

timtro commented 1 day ago

I can confirm that removing FLAG_MSAA_4X_HINT removes the holes. Thanks, Raysan. So this is a driver issue?

Would you like my driver/OS information for any possible future investigation?