From d2f8741fcc0fa1c7d9bf2a643ed2045d29cf424f Mon Sep 17 00:00:00 2001 From: Luke Benstead Date: Wed, 7 Apr 2021 15:35:28 +0100 Subject: [PATCH] Add some more samples to CMake --- CMakeLists.txt | 4 +++- samples/depth_funcs_ortho/main.c | 6 +++--- samples/lights/main.c | 19 +++++++++++++------ samples/mipmap/main.c | 20 ++++++++++++++------ 4 files changed, 33 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0f40550..786a87a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,5 +50,7 @@ add_executable(nehe02 samples/nehe02/main.c) add_executable(blend_test samples/blend_test/main.c) add_executable(depth_funcs samples/depth_funcs/main.c) add_executable(depth_funcs_alpha_testing samples/depth_funcs_alpha_testing/main.c samples/depth_funcs_alpha_testing/gl_png.c) - +add_executable(depth_funcs_ortho samples/depth_funcs_ortho/main.c) +add_executable(lights samples/lights/main.c) +add_executable(mipmap samples/mipmap/main.c) diff --git a/samples/depth_funcs_ortho/main.c b/samples/depth_funcs_ortho/main.c index 01a3639..837ede0 100644 --- a/samples/depth_funcs_ortho/main.c +++ b/samples/depth_funcs_ortho/main.c @@ -1,6 +1,6 @@ -#include "gl.h" -#include "glu.h" -#include "glkos.h" +#include "GL/gl.h" +#include "GL/glu.h" +#include "GL/glkos.h" /* A general OpenGL initialization function. Sets all of the initial parameters. */ void InitGL(int Width, int Height) // We call this right after our OpenGL window is created. diff --git a/samples/lights/main.c b/samples/lights/main.c index 72777eb..4f0a3dc 100644 --- a/samples/lights/main.c +++ b/samples/lights/main.c @@ -1,12 +1,19 @@ #include +#include +#include -#include "gl.h" -#include "glu.h" -#include "glkos.h" +#include "GL/gl.h" +#include "GL/glu.h" +#include "GL/glkos.h" -extern uint8 romdisk[]; +extern uint8_t romdisk[]; KOS_INIT_ROMDISK(romdisk); +#ifdef __DREAMCAST__ +#define IMAGE_FILENAME "/rd/NeHe.bmp" +#else +#define IMAGE_FILENAME "samples/lights/romdisk/NeHe.bmp" +#endif float xrot, yrot, zrot; @@ -89,7 +96,7 @@ int ImageLoad(char *filename, Image *image) { } if ((i = fread(image->data, size, 1, file)) != 1) { - printf(stderr, "Error reading image data from %s.\n", filename); + fprintf(stderr, "Error reading image data from %s.\n", filename); return 0; } @@ -115,7 +122,7 @@ void LoadGLTextures() { exit(0); } - if (!ImageLoad("/rd/NeHe.bmp", image1)) { + if (!ImageLoad(IMAGE_FILENAME, image1)) { exit(1); } diff --git a/samples/mipmap/main.c b/samples/mipmap/main.c index 15397d3..0ab8447 100644 --- a/samples/mipmap/main.c +++ b/samples/mipmap/main.c @@ -1,13 +1,21 @@ #include #include +#include -#include "gl.h" -#include "glu.h" -#include "glkos.h" +#include "GL/gl.h" +#include "GL/glu.h" +#include "GL/glext.h" +#include "GL/glkos.h" -extern uint8 romdisk[]; +extern uint8_t romdisk[]; KOS_INIT_ROMDISK(romdisk); +#ifdef __DREAMCAST__ +#define IMAGE_FILENAME "/rd/NeHe.bmp" +#else +#define IMAGE_FILENAME "samples/mipmap/romdisk/NeHe.bmp" +#endif + /* storage for one texture */ int texture[1]; @@ -87,7 +95,7 @@ int ImageLoad(char *filename, Image *image) { } if ((i = fread(image->data, size, 1, file)) != 1) { - printf(stderr, "Error reading image data from %s.\n", filename); + fprintf(stderr, "Error reading image data from %s.\n", filename); return 0; } @@ -113,7 +121,7 @@ void LoadGLTextures() { exit(0); } - if (!ImageLoad("/rd/NeHe.bmp", image1)) { + if (!ImageLoad(IMAGE_FILENAME, image1)) { exit(1); }