Merge branch 'update-cubes-cmakelists' into 'master'
Update cubes sample + cmakelists See merge request simulant/GLdc!104
This commit is contained in:
commit
db385816f0
|
@ -29,15 +29,21 @@ else()
|
||||||
check_c_compiler_flag("-mfsca" COMPILER_HAS_FSCA)
|
check_c_compiler_flag("-mfsca" COMPILER_HAS_FSCA)
|
||||||
if(COMPILER_HAS_FSRRA)
|
if(COMPILER_HAS_FSRRA)
|
||||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -mfsrra")
|
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -mfsrra")
|
||||||
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -mfsrra")
|
||||||
endif()
|
endif()
|
||||||
if(COMPILER_HAS_FSCA)
|
if(COMPILER_HAS_FSCA)
|
||||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -mfsca")
|
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -mfsca")
|
||||||
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -mfsca")
|
||||||
endif()
|
endif()
|
||||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -ffp-contract=fast -ffast-math")
|
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()
|
endif()
|
||||||
|
|
||||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -fexpensive-optimizations -fomit-frame-pointer -finline-functions")
|
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_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(
|
set(
|
||||||
SOURCES
|
SOURCES
|
||||||
|
|
|
@ -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
|
- kospvr - This is the hardware-accelerated Dreamcast backend
|
||||||
- software - This is a stub software rasterizer used for testing testing and debugging
|
- 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
|
mkdir dcbuild
|
||||||
|
@ -41,6 +41,11 @@ cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/Dreamcast.cmake -G "Unix Makefiles" .
|
||||||
make
|
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
|
You will need KallistiOS compiled and configured (e.g. the KOS_BASE environment
|
||||||
variable must be set)
|
variable must be set)
|
||||||
|
|
||||||
|
|
|
@ -28,27 +28,25 @@ bool isDrawingArrays = false;
|
||||||
bool isBlendingEnabled = true;
|
bool isBlendingEnabled = true;
|
||||||
bool isRunning = true;
|
bool isRunning = true;
|
||||||
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
float r;
|
GLubyte r;
|
||||||
float g;
|
GLubyte g;
|
||||||
float b;
|
GLubyte b;
|
||||||
float a;
|
GLubyte a;
|
||||||
} Color;
|
} Color;
|
||||||
|
|
||||||
Color colors[] =
|
Color colors[] =
|
||||||
{
|
{
|
||||||
{1.0f, 0.0f, 0.0f, 0.5f}, // red
|
{255, 0, 0, 128},
|
||||||
{0.0f, 1.0f, 0.0f, 0.5f}, // green
|
{0, 255, 0, 128},
|
||||||
{0.0f, 0.0f, 1.0f, 0.5f}, // blue
|
{0, 0, 255, 128},
|
||||||
{1.0f, 1.0f, 0.0f, 0.5f}, // yellow
|
{255, 255, 0, 128},
|
||||||
{1.0f, 0.0f, 1.0f, 0.5f}, // magenta
|
{255, 0, 255, 128},
|
||||||
{0.0f, 1.0f, 1.0f, 0.5f} // cyan
|
{0, 255, 255, 128}
|
||||||
};
|
};
|
||||||
Color faceColors[24];
|
Color faceColors[24];
|
||||||
|
|
||||||
|
|
||||||
float cubeVertices[] =
|
float cubeVertices[] =
|
||||||
{
|
{
|
||||||
// Front face
|
// Front face
|
||||||
|
@ -210,7 +208,7 @@ void renderUnitCube()
|
||||||
glEnableClientState(GL_COLOR_ARRAY);
|
glEnableClientState(GL_COLOR_ARRAY);
|
||||||
|
|
||||||
glVertexPointer(3, GL_FLOAT, 0, cubeVertices);
|
glVertexPointer(3, GL_FLOAT, 0, cubeVertices);
|
||||||
glColorPointer(4, GL_FLOAT, 0, faceColors);
|
glColorPointer(4, GL_UNSIGNED_BYTE, 0, faceColors);
|
||||||
|
|
||||||
if (isDrawingArrays) {
|
if (isDrawingArrays) {
|
||||||
glDrawArrays(GL_QUADS, 0, 24);
|
glDrawArrays(GL_QUADS, 0, 24);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user