vydd / sketch

A Common Lisp framework for the creation of electronic art, visual design, game prototyping, game making, computer graphics, exploration of human-computer interaction, and more.
MIT License
1.4k stars 67 forks source link

Changed colors with load image #32

Closed ulrivo closed 1 year ago

ulrivo commented 4 years ago

If I load a PNG-file, instead of red the color blue is rendered.

(defsketch image ((title "image") (width 500) (height 600)) (image (load-resource "png/my-image.png") 100 50)

vydd commented 4 years ago

Hey @ulrivo,

Is this the same for every image? Which platform are you on? (lisp, os) If not all images are shown like this, could you send me the exact image you're using?

Thanks!

ulrivo commented 4 years ago

I tried different PNG-files, the colors are always twisted - wrong texture?

I am using CCL64 (Clozure Common Lisp Version 1.11.6 DarwinX8664) on Mac OS X and attach a PNG which is shown in blue instead of red.

10_of_hearts

n00p3 commented 3 years ago

I have the same issue, changing :bgra to :rgba here solves this problem. SBCL 2.1.5 Manjaro x64

vydd commented 3 years ago

@n00p3 any ideas on how we could identify the correct parameter here?

n00p3 commented 3 years ago

@vydd Quick & dirty solution would be to use imagemagick to identify colorspace of image identify -verbose image.png | grep Colorspace | awk '{ print $2 }' but this is far from acceptable answer. I don't know much of OpenGL to help with this topic. How about letting user specify format when loading resource? Something like this (load-resource "image.png" :format :rgba)