Start load texture logic

I just wanted to get something in here to make sure the branch is working with automatic tests and that FreeImage wouldn't throw errors now that I'm actually using it.
This commit is contained in:
Jack 2024-08-23 21:47:37 -04:00
parent c3508f28a5
commit 347d46c900
3 changed files with 29 additions and 0 deletions

10
include/load_texture.h Normal file
View File

@ -0,0 +1,10 @@
#ifndef LOAD_TEXTURE_H_
#define LOAD_TEXTURE_H_
#include <FreeImage.h>
namespace Texture {
void LoadTexture(const char* filePath);
}
#endif // LOAD_TEXTURE_H_

16
source/load_texture.cpp Normal file
View File

@ -0,0 +1,16 @@
#include "load_texture.h"
#include <iostream>
namespace Texture {
void LoadTexture(const char* filePath) {
FIBITMAP* bitmap = FreeImage_Load(FIF_TIFF, filePath, TIFF_DEFAULT);
if(!bitmap) {
std::cerr << "Failed to load TIFF image: " << filePath << std::endl;
}
FIBITMAP* bitmap32 = FreeImage_ConvertTo32Bits(bitmap);
FreeImage_Unload(bitmap);
}
}

View File

@ -35,6 +35,8 @@
#include <imgui_impl_glfw.h> #include <imgui_impl_glfw.h>
#include <imgui_impl_opengl3.h> #include <imgui_impl_opengl3.h>
#include <FreeImage.h>
#include "callbacks.h" #include "callbacks.h"
#include "scene.h" #include "scene.h"
@ -146,6 +148,7 @@ int main() {
Callbacks::Register(window, &scene); Callbacks::Register(window, &scene);
scene.Init(); scene.Init();
InitializeImGui(window); InitializeImGui(window);
FreeImage_Initialise();
// Check if we're in test mode // Check if we're in test mode
const char* testEnv = std::getenv("TEST_MODE"); const char* testEnv = std::getenv("TEST_MODE");