Online script throwing WEBGL loss of context

I’m designing a fairly simple study - basically a version of the Stroop task. Have subjects press a button in response to an image and a text prompt (which are randomly paired with each other).

With larger images (600kb), things seem to run OK for 15-20 trials, but then I get a WebGL:Loss of Context error. I’ve tried it in Firefox and Chrome and get the same error, around the same time point.

Note, it doesn’t seem to make a difference whether I upload just the stimuli I need, or include some for a second condition.

Also, everytime the a new stimulus is presented (whether a real trial or an instruction image, or just text rendered on the screen), I get a warning from WebGL: Error: WebGL: texImage2D: Conversion requires pixel reformatting.

To replicate errors from the web side, see here (and enter any # under participant): awssmweis.bitnamiapp.com/friz/

Please let me know if more info would be useful, or if there is some simple setting I’m missing in the Psychopy Builder before I export.

Thanks,
Steve

Update: It appears that it works with smaller images (~40kb) but not larger images (600kb). If anyone can replicate the error with the smaller images, please let me know!

The size of the mage in kB on the disk is not really relevant, as it depends on the compression used. The relevant consideration is the pixel dimensions, as this is what consumes memory on the graphics card (i.e. a tiny image on disk can be decompressed to be a massive number of pixels: for example a 1024 × 768 pixel rectangle of a single colour would be represented by a tiny .png file, but take up exactly the same amount of memory on the graphics card as a 1024 × 768 complex photographic image, which couldn’t be compressed as well on disk.

So tell us the pixel dimensions, and also ensure that they are pre-scaled to match the resolution you will be displaying on screen. e.g. if your stimulus will be 1024 × 768 on screen, don’t use an image file that is 2048 × 1536, as 75% of the pixels are not needed.

Thanks!

The images are 1200 x 1200 pixels at 300 DPI.

The screen size on which they’ll be displayed actually leads me to another question: in putting this study online, monitors might be a variety of sizes. Will PsychoPy detect this dynamically? It appears that the answer is yes, in which case presenting the image relative to the size of the screen is great - but might mess up the compression?

Yes, PsychoPy will scale the images to whatever size you tell it to display the images at (if you specify a size).

At the moment I’d recommend you don’t use the online study options unless you really know what you’re doing. It is at a very early stage of development, and we’re just making it available so that people can see the approach. Basically there are almost certainly bugs at the moment and if aren’t really tech-savvy then you might not spot a critical issue. We’ve now got funding to make this much more polished and get rid of any bugs, but the launch of that will be mid-2018.

I’ve managed to squash a few bugs in my online version of the study by editing the index.html script. It really seems to work without any hiccups, though I’ve had to add a few work-arounds (like using two separate studies instead of nesting two loops).

The only thing I’ve come up with so far that seems possibly problematic is this WebGL loss of context (haven’t replicated since making smaller images), and the sizes of the images on different screens (though it seems good on most laptops/desktops).

I’m not sure I “really know what I’m doing,” but it really does seem like it works as expected.

Take it for a test drive yourself, if you’re so inclined: awssmweis.bitnamiapp.com/friz

OK, well if it’s working for you that’s great. Just beware that this has had minimal testing at this stage. I can’t tell you how the timing is etc. (When I first created Builder there was a big red warning sign on the documentation that said “this is just for testing at the moment” and someone still went off, used it and then wrote a disparaging paper about our timing in that very early draft of what we’re doing. I’m a bit sensitive now! :wink: )

Maybe the bugs you fixed along the way can be incorporated by us in the main builder outputs so they’re fixed for next time? Did you keep track of what had to be changed?

For the “WebGL:Loss of Context” Error I doubt this will get looked at imminently. Ilixa haven’t (re)started work with us yet and I think we’ll need them on it. I’ve create an issue for this on github to keep track of though:
https://github.com/psychopy/psychojs/issues/13

Awesome. I won’t blame you if it all goes to hell :slight_smile: I’ll keep an eye on the Github issue and comment there if I find it occurring again (or differently).

As for the bugs: I’ve delineated here. I can also send you the two versions of the index.html (the one I modified and the one generated by Export HTML) if that’s more helpful. Most of these were things I couldn’t figure out how to do in the Builder, so it’s possible I missed something there.

  1. Set “psychoJS.debug” to false (gets rid of frame rate tracking).
  2. expName set as “stroop” every time, instead of my experiment name.
  3. expInfo library set as default (‘participant’, ‘session’) instead of what I changed it to in Builder.
  4. Changed each instance of ‘escape’ allowing the participant to quit the study by deleting ‘escape’ from getKeys…keyList, and changing this from true to false: if (“escape”) in theseKeys) { endExpNow = false;}
  5. Edited triple quotes (required for text component with variable) by hand to match js formatting.

Oh, also, this wasn’t in index.html, but each time I export to HTML, the csv files in the resources folder don’t automatically delete the last line (when created in Excel), leading to a bug in the actual study caused by the \n character not being eliminated.

If I think of any others, I can let you know.

1 Like