#Shader with multiple textures not working

6 messages · Page 1 of 1 (latest)

novel kiln
#

Hi ! Im working on a game right now and wanted to work around the shaders. I<ve learned the basics with the catlikecoding series and wanted to do my first shader. Ive worked on this new shader with a mask which was included in the examples.

I am trying to add new textures so there would be three textures in this case. When it comes time to load the new texture when I compile it fails. I isolated the problem and it seems due to this in my main file game.c

Shader shader = LoadShader(0, TextFormat("resources/mask.fs", GLSL_VERSION));
Texture2D texDiffuse = LoadTexture("resources/plasma.png");
Texture2D texMask = LoadTexture("resources/mask.png");
Texture2D texDiffuse2 = LoadTexture("resources/red.png");

model2.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texDiffuse;
**model2.materials[1].maps[MATERIAL_MAP_DIFFUSE].texture = texDiffuse2;**

// create mask for shader
// material map emission for 2nd texture
model2.materials[0].maps[MATERIAL_MAP_EMISSION].texture = texMask;
shader.locs[SHADER_LOC_MAP_EMISSION] = GetShaderLocation(shader, "mask");

Here is my shader file attached for more details on how it works
and the error im receiving with the compiler is this :
INFO: FILEIO: [resources/mask.fs] File loaded successfully
WARNING: IMAGE: Data format not supported
WARNING: IMAGE: Failed to load image data
WARNING: IMAGE: Data is not valid to load texture
Segmentation fault (core dumped)

I checked that all my images dimensions are power of 2 and it seems fine. I can even see the third texture allowed space on my cube when I compile without the texture. Which means my shader seems to be working correctly

Thanks for reading this

plain spear
#

Also, upload one of those images in a zip

novel kiln
#

I do have init window before any of this