Skip to content

loadModel() options break without fileType and ignore flipU/flipV #9302

Open

Description

@bhabishnu

Most appropriate sub-area of p5.js?

  • Accessibility
  • Color
  • Core/Environment/Rendering
  • Data
  • DOM
  • Events
  • Image
  • IO
  • Math
  • Typography
  • Utilities
  • WebGL
  • WebGPU
  • p5.strands
  • Build process
  • Unit testing
  • Internationalization
  • Friendly errors
  • Other (specify if possible)

p5.js version

2.3.2 / current main

Web browser and version

Chromium 151

Operating system

Fedora Linux

Steps to reproduce this

The documented loadModel(path, options) overload breaks depending on whether fileType is included.

async function setup() {
  createCanvas(100, 100, WEBGL);

  // Throws: fileType.toLowerCase is not a function
  await loadModel('model.obj', { flipU: true });

  // Loads, but flipU is ignored
  await loadModel('model.obj', {
    fileType: '.obj',
    flipU: true
  });
}

Options like { normalize: true } or {} also throw when fileType is omitted. With fileType present, flipU / flipV are ignored, although calling model.flipU() / model.flipV() afterwards works.

Expected: loadModel(path, options) should work without requiring fileType, and the flip options should be applied.

I traced it to the options parsing here:

p5.js/src/webgl/loading.js

Lines 573 to 581 in 24a68d5

if (typeof fileType === 'object') {
// Passing in options object
normalize = fileType.normalize || false;
successCallback = fileType.successCallback;
failureCallback = fileType.failureCallback;
fileType = fileType.fileType || fileType;
flipU = fileType.flipU || false;
flipV = fileType.flipV || false;
} else {

fileType is reassigned before flipU / flipV are read, so without fileType the options object eventually reaches .toLowerCase(), while with it the flags are read from a string.

Activity

  1. bababananaa commented on Oct 17, 2026

    @bababananaa

    Hi! Can I be assigned to this issue?

  2. saniyaa-17 commented on Oct 17, 2026

    @saniyaa-17

    Hi! I'd like to contribute to this issue. I've reviewed the problem with loadModel() options, including fileType, flipU, and flipV. I'd like to investigate the options parsing and add a regression test for the reported behavior. Please let me know if I can work on this. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions