diff --git a/CMakeLists.txt b/CMakeLists.txt index 13ad28d..b26026a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,15 +29,21 @@ else() check_c_compiler_flag("-mfsca" COMPILER_HAS_FSCA) if(COMPILER_HAS_FSRRA) set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -mfsrra") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -mfsrra") endif() if(COMPILER_HAS_FSCA) set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -mfsca") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -mfsca") endif() set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -ffp-contract=fast -ffast-math") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -ffast-math") endif() set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -fexpensive-optimizations -fomit-frame-pointer -finline-functions") +set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -std=c++14 -fwhole-program -O3 -g0 -s -fomit-frame-pointer -fstrict-aliasing") + set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0 -g -Wall -Wextra") +set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g -Wall -Wextra") set( SOURCES diff --git a/README.md b/README.md index b4b0fc7..2df585c 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ GLdc uses CMake for its build system, it currently ships with two "backends": - kospvr - This is the hardware-accelerated Dreamcast backend - software - This is a stub software rasterizer used for testing testing and debugging -To compile for Dreamcast, you'll want to do something like the following: +To compile a Dreamcast debug build, you'll want to do something like the following: ``` mkdir dcbuild @@ -41,6 +41,11 @@ cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/Dreamcast.cmake -G "Unix Makefiles" . make ``` +For a release build, replace the cmake line with with the following: +``` +cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/Dreamcast.cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release .. +``` + You will need KallistiOS compiled and configured (e.g. the KOS_BASE environment variable must be set) diff --git a/samples/cubes/main.cpp b/samples/cubes/main.cpp index 2fe6329..eaeeaea 100644 --- a/samples/cubes/main.cpp +++ b/samples/cubes/main.cpp @@ -28,27 +28,25 @@ bool isDrawingArrays = false; bool isBlendingEnabled = true; bool isRunning = true; - typedef struct { - float r; - float g; - float b; - float a; + GLubyte r; + GLubyte g; + GLubyte b; + GLubyte a; } Color; Color colors[] = { - {1.0f, 0.0f, 0.0f, 0.5f}, // red - {0.0f, 1.0f, 0.0f, 0.5f}, // green - {0.0f, 0.0f, 1.0f, 0.5f}, // blue - {1.0f, 1.0f, 0.0f, 0.5f}, // yellow - {1.0f, 0.0f, 1.0f, 0.5f}, // magenta - {0.0f, 1.0f, 1.0f, 0.5f} // cyan + {255, 0, 0, 128}, + {0, 255, 0, 128}, + {0, 0, 255, 128}, + {255, 255, 0, 128}, + {255, 0, 255, 128}, + {0, 255, 255, 128} }; Color faceColors[24]; - float cubeVertices[] = { // Front face @@ -210,7 +208,7 @@ void renderUnitCube() glEnableClientState(GL_COLOR_ARRAY); glVertexPointer(3, GL_FLOAT, 0, cubeVertices); - glColorPointer(4, GL_FLOAT, 0, faceColors); + glColorPointer(4, GL_UNSIGNED_BYTE, 0, faceColors); if (isDrawingArrays) { glDrawArrays(GL_QUADS, 0, 24);