Skip to content

Commit 98a6422

Browse files
committed
Load images as non-sRGB textures
1 parent 378939e commit 98a6422

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

Sources/vger/vger.mm

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,10 @@ void vgerBegin(vgerContext vg, float windowWidth, float windowHeight, float devi
112112
vgerImageIndex vgerCreateImage(vgerContext vg, const char* filename) {
113113

114114
auto url = [NSURL fileURLWithPath:[NSString stringWithUTF8String:filename]];
115+
auto options = @{ MTKTextureLoaderOptionSRGB: @NO };
115116

116117
NSError* error;
117-
auto tex = [vg->textureLoader newTextureWithContentsOfURL:url options:nil error:&error];
118+
auto tex = [vg->textureLoader newTextureWithContentsOfURL:url options:options error:&error];
118119

119120
if(error) {
120121
NSLog(@"error loading texture: %@", error);
@@ -137,9 +138,10 @@ vgerImageIndex vgerCreateImageMem(vgerContext vg, const uint8_t* data, size_t si
137138
}
138139

139140
auto nsdata = [NSData dataWithBytesNoCopy:(void*)data length:size freeWhenDone:NO];
141+
auto options = @{ MTKTextureLoaderOptionSRGB: @NO };
140142

141143
NSError* error;
142-
auto tex = [vg->textureLoader newTextureWithData:nsdata options:nil error:&error];
144+
auto tex = [vg->textureLoader newTextureWithData:nsdata options:options error:&error];
143145

144146
if(error) {
145147
NSLog(@"vgerCreateImageMem: error loading texture: %@", error);

0 commit comments

Comments
 (0)