Fix 8.3. Tesselation

- CMake: Handle *.tcs and *.tes shader files
- avoid directory name “resources”, since it triggers weird behaviour of glfwInit() on mac os (see remarks at https://www.glfw.org/docs/3.3/group__init.html#ga317aac130a235ab08c6db0834907d85e)
- shader loader: print exception messages
This commit is contained in:
David Siegel
2023-05-16 20:24:05 +02:00
parent 8d0becc0cd
commit 90737bb654
10 changed files with 13 additions and 8 deletions

View File

@@ -179,8 +179,8 @@ set(GUEST_ARTICLES
8.guest/2021/1.scene/1.scene_graph
8.guest/2021/1.scene/2.frustum_culling
8.guest/2021/2.csm
#8.guest/2021/3.tessellation/terrain_gpu_dist
#8.guest/2021/3.tessellation/terrain_cpu_src
8.guest/2021/3.tessellation/terrain_gpu_dist
8.guest/2021/3.tessellation/terrain_cpu_src
8.guest/2021/4.dsa
8.guest/2022/5.computeshader_helloworld
8.guest/2022/6.physically_based_bloom
@@ -208,6 +208,8 @@ function(create_project_from_sources chapter demo)
"src/${chapter}/${demo}/*.cpp"
"src/${chapter}/${demo}/*.vs"
"src/${chapter}/${demo}/*.fs"
"src/${chapter}/${demo}/*.tcs"
"src/${chapter}/${demo}/*.tes"
"src/${chapter}/${demo}/*.gs"
"src/${chapter}/${demo}/*.cs"
)
@@ -239,6 +241,8 @@ function(create_project_from_sources chapter demo)
"src/${chapter}/${demo}/*.vs"
# "src/${chapter}/${demo}/*.frag"
"src/${chapter}/${demo}/*.fs"
"src/${chapter}/${demo}/*.tcs"
"src/${chapter}/${demo}/*.tes"
"src/${chapter}/${demo}/*.gs"
"src/${chapter}/${demo}/*.cs"
)

View File

@@ -76,7 +76,8 @@ public:
}
catch (std::ifstream::failure& e)
{
std::cout << "ERROR::SHADER::FILE_NOT_SUCCESSFULLY_READ" << std::endl;
std::cout << "ERROR::SHADER::FILE_NOT_SUCCESSFULLY_READ: "
<< e.what() << std::endl;
}
const char* vShaderCode = vertexCode.c_str();
const char * fShaderCode = fragmentCode.c_str();

View File

@@ -90,7 +90,7 @@ int main()
// The FileSystem::getPath(...) is part of the GitHub repository so we can find files on any IDE/platform; replace it with your own image path.
stbi_set_flip_vertically_on_load(true);
int width, height, nrChannels;
unsigned char *data = stbi_load("resources/heightmaps/iceland_heightmap.png", &width, &height, &nrChannels, 0);
unsigned char *data = stbi_load("heightmaps/iceland_heightmap.png", &width, &height, &nrChannels, 0);
if (data)
{
std::cout << "Loaded heightmap of size " << height << " x " << width << std::endl;

View File

@@ -103,7 +103,7 @@ int main()
// load image, create texture and generate mipmaps
int width, height, nrChannels;
// The FileSystem::getPath(...) is part of the GitHub repository so we can find files on any IDE/platform; replace it with your own image path.
unsigned char *data = stbi_load("resources/heightmaps/iceland_heightmap.png", &width, &height, &nrChannels, 0);
unsigned char *data = stbi_load("heightmaps/iceland_heightmap.png", &width, &height, &nrChannels, 0);
if (data)
{
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);