Corrected some issues
This commit is contained in:
parent
6546474fa4
commit
e893f3629e
@ -26,7 +26,7 @@ int main()
|
|||||||
Image image = LoadImage("resources/cubicmap.png"); // Load cubicmap image (RAM)
|
Image image = LoadImage("resources/cubicmap.png"); // Load cubicmap image (RAM)
|
||||||
Texture2D cubicmap = LoadTextureFromImage(image); // Convert image to texture to display (VRAM)
|
Texture2D cubicmap = LoadTextureFromImage(image); // Convert image to texture to display (VRAM)
|
||||||
|
|
||||||
Mesh mesh = GenMeshCubicmap(image, VectorOne());
|
Mesh mesh = GenMeshCubicmap(image, (Vector3){ 1.0f, 1.0f, 1.0f });
|
||||||
Model model = LoadModelFromMesh(mesh, false);
|
Model model = LoadModelFromMesh(mesh, false);
|
||||||
|
|
||||||
// NOTE: By default each cube is mapped to one part of texture atlas
|
// NOTE: By default each cube is mapped to one part of texture atlas
|
||||||
|
@ -627,10 +627,10 @@ Mesh LoadMesh(const char *fileName)
|
|||||||
#if defined(SUPPORT_FILEFORMAT_OBJ)
|
#if defined(SUPPORT_FILEFORMAT_OBJ)
|
||||||
if (IsFileExtension(fileName, ".obj")) mesh = LoadOBJ(fileName);
|
if (IsFileExtension(fileName, ".obj")) mesh = LoadOBJ(fileName);
|
||||||
#else
|
#else
|
||||||
TraceLog(WARNING, "[%s] Mesh fileformat not supported, it can't be loaded", fileName);
|
TraceLog(LOG_WARNING, "[%s] Mesh fileformat not supported, it can't be loaded", fileName);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (mesh.vertexCount == 0) TraceLog(WARNING, "Mesh could not be loaded");
|
if (mesh.vertexCount == 0) TraceLog(LOG_WARNING, "Mesh could not be loaded");
|
||||||
else rlLoadMesh(&mesh, false); // Upload vertex data to GPU (static mesh)
|
else rlLoadMesh(&mesh, false); // Upload vertex data to GPU (static mesh)
|
||||||
|
|
||||||
// TODO: Initialize default mesh data in case loading fails, maybe a cube?
|
// TODO: Initialize default mesh data in case loading fails, maybe a cube?
|
||||||
@ -1269,7 +1269,7 @@ Material LoadMaterial(const char *fileName)
|
|||||||
#if defined(SUPPORT_FILEFORMAT_MTL)
|
#if defined(SUPPORT_FILEFORMAT_MTL)
|
||||||
if (IsFileExtension(fileName, ".mtl")) material = LoadMTL(fileName);
|
if (IsFileExtension(fileName, ".mtl")) material = LoadMTL(fileName);
|
||||||
#else
|
#else
|
||||||
TraceLog(WARNING, "[%s] Material fileformat not supported, it can't be loaded", fileName);
|
TraceLog(LOG_WARNING, "[%s] Material fileformat not supported, it can't be loaded", fileName);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return material;
|
return material;
|
||||||
|
@ -338,7 +338,7 @@ static unsigned int LoadShaderProgram(const char *vShaderStr, const char *fShade
|
|||||||
|
|
||||||
static Shader LoadShaderDefault(void); // Load default shader (just vertex positioning and texture coloring)
|
static Shader LoadShaderDefault(void); // Load default shader (just vertex positioning and texture coloring)
|
||||||
static void SetShaderDefaultLocations(Shader *shader); // Bind default shader locations (attributes and uniforms)
|
static void SetShaderDefaultLocations(Shader *shader); // Bind default shader locations (attributes and uniforms)
|
||||||
static void UnLoadShaderDefault(void); // Unload default shader
|
static void UnloadShaderDefault(void); // Unload default shader
|
||||||
|
|
||||||
static void LoadDefaultBuffers(void); // Load default internal buffers (lines, triangles, quads)
|
static void LoadDefaultBuffers(void); // Load default internal buffers (lines, triangles, quads)
|
||||||
static void UpdateDefaultBuffers(void); // Update default internal buffers (VAOs/VBOs) with vertex data
|
static void UpdateDefaultBuffers(void); // Update default internal buffers (VAOs/VBOs) with vertex data
|
||||||
@ -1532,7 +1532,7 @@ void rlUpdateTexture(unsigned int id, int width, int height, int format, const v
|
|||||||
case UNCOMPRESSED_R5G5B5A1: glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, (unsigned short *)data); break;
|
case UNCOMPRESSED_R5G5B5A1: glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, (unsigned short *)data); break;
|
||||||
case UNCOMPRESSED_R4G4B4A4: glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, (unsigned short *)data); break;
|
case UNCOMPRESSED_R4G4B4A4: glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, (unsigned short *)data); break;
|
||||||
case UNCOMPRESSED_R8G8B8A8: glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, (unsigned char *)data); break;
|
case UNCOMPRESSED_R8G8B8A8: glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, (unsigned char *)data); break;
|
||||||
default: TraceLog(WARNING, "Texture format updating not supported"); break;
|
default: TraceLog(LOG_WARNING, "Texture format updating not supported"); break;
|
||||||
}
|
}
|
||||||
#elif defined(GRAPHICS_API_OPENGL_11) || defined(GRAPHICS_API_OPENGL_ES2)
|
#elif defined(GRAPHICS_API_OPENGL_11) || defined(GRAPHICS_API_OPENGL_ES2)
|
||||||
// NOTE: on OpenGL ES 2.0 (WebGL), internalFormat must match format and options allowed are: GL_LUMINANCE, GL_RGB, GL_RGBA
|
// NOTE: on OpenGL ES 2.0 (WebGL), internalFormat must match format and options allowed are: GL_LUMINANCE, GL_RGB, GL_RGBA
|
||||||
@ -1545,7 +1545,7 @@ void rlUpdateTexture(unsigned int id, int width, int height, int format, const v
|
|||||||
case UNCOMPRESSED_R5G5B5A1: glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, (unsigned short *)data); break;
|
case UNCOMPRESSED_R5G5B5A1: glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, (unsigned short *)data); break;
|
||||||
case UNCOMPRESSED_R4G4B4A4: glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, (unsigned short *)data); break;
|
case UNCOMPRESSED_R4G4B4A4: glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, (unsigned short *)data); break;
|
||||||
case UNCOMPRESSED_R8G8B8A8: glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, (unsigned char *)data); break;
|
case UNCOMPRESSED_R8G8B8A8: glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, (unsigned char *)data); break;
|
||||||
default: TraceLog(WARNING, "Texture format updating not supported"); break;
|
default: TraceLog(LOG_WARNING, "Texture format updating not supported"); break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -3454,7 +3454,7 @@ static Shader LoadShaderDefault(void)
|
|||||||
shader.locs[LOC_COLOR_DIFFUSE] = glGetUniformLocation(shader.id, "colDiffuse");
|
shader.locs[LOC_COLOR_DIFFUSE] = glGetUniformLocation(shader.id, "colDiffuse");
|
||||||
shader.locs[LOC_TEXMAP_DIFFUSE] = glGetUniformLocation(shader.id, "texture0");
|
shader.locs[LOC_TEXMAP_DIFFUSE] = glGetUniformLocation(shader.id, "texture0");
|
||||||
}
|
}
|
||||||
else TraceLog(WARNING, "[SHDR ID %i] Default shader could not be loaded", shader.id);
|
else TraceLog(LOG_WARNING, "[SHDR ID %i] Default shader could not be loaded", shader.id);
|
||||||
|
|
||||||
return shader;
|
return shader;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user