Commit e317d970 authored by Johannes Braun's avatar Johannes Braun
Browse files

Several Fixes

parent df9e0370
cmake_minimum_required(VERSION 3.1)
message(${CMAKE_CXX_COMPILER})
#set(CMAKE_C_COMPILER_DEBUG "C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.11.25503/bin/HostX64/x64/cl.exe")
#set(CMAKE_CXX_COMPILER_DEBUG "C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.11.25503/bin/HostX64/x64/cl.exe")
include(config.cmake)
include(${CMAKE_MODULE_PATH}/setup/system_check.cmake)
......@@ -10,7 +15,7 @@ include(${CMAKE_MODULE_PATH}/setup/macros.cmake)
set(CMAKE_CXX_STANDARD 17)
if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++latest")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++latest")
endif()
if(SYS_WINDOWS)
......
{
// Informationen zu dieser Datei finden Sie unter https://go.microsoft.com//fwlink//?linkid=834763.
"configurations": [
{
"name": "x86-Debug",
"generator": "Ninja",
"configurationType" : "Debug",
"inheritEnvironments": [ "msvc_x86" ],
"buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "-v",
"ctestCommandArgs": ""
},
{
"name": "x86-Release",
"generator": "Ninja",
"configurationType" : "RelWithDebInfo",
"inheritEnvironments": [ "msvc_x86" ],
"buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "-v",
"ctestCommandArgs": ""
},
{
"name": "x64-Debug",
"generator": "Ninja",
"configurationType" : "Debug",
"inheritEnvironments": [ "msvc_x64" ],
"buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "-v",
"ctestCommandArgs": ""
},
{
"name": "x64-Release",
"generator": "Ninja",
"configurationType" : "RelWithDebInfo",
"inheritEnvironments": [ "msvc_x64" ],
"buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "-v",
"ctestCommandArgs": ""
}
]
}
\ No newline at end of file
set(LIBS_PATH ${CMAKE_SOURCE_DIR}/lib)
include(${CMAKE_MODULE_PATH}/setup/library.cmake)
#OpenMP
find_package(OpenMP REQUIRED)
if (OPENMP_FOUND)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif()
#GLEW
find_and_add_library(GLEW REQUIRED LIBRARIES)
add_definitions(-DGLEW_STATIC)
......@@ -28,11 +35,4 @@ find_and_add_library(STB REQUIRED LIBRARIES)
#OpenAL
find_and_add_library(OpenAL REQUIRED LIBRARIES)
#OpenMP
find_package(OpenMP)
if (OPENMP_FOUND)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif()
message("Loaded external libraries.")
\ No newline at end of file
......@@ -289,10 +289,14 @@ struct Texture
{
switch (components)
{
case 1: return gl::TextureFormat::eRed;
case 2: return gl::TextureFormat::eRG;
case 3: return gl::TextureFormat::eRGB;
case 4: return gl::TextureFormat::eRGBA;
case 1: if constexpr(std::is_same_v<T, int32_t> || std::is_same_v<T, uint32_t>) return gl::TextureFormat::eRedInt;
else return gl::TextureFormat::eRed;
case 2: if constexpr(std::is_same_v<T, int32_t> || std::is_same_v<T, uint32_t>) return gl::TextureFormat::eRGInt;
else return gl::TextureFormat::eRG;
case 3: if constexpr(std::is_same_v<T, int32_t> || std::is_same_v<T, uint32_t>) return gl::TextureFormat::eRGBInt;
else return gl::TextureFormat::eRGB;
case 4: if constexpr(std::is_same_v<T, int32_t> || std::is_same_v<T, uint32_t>) return gl::TextureFormat::eRGBAInt;
else return gl::TextureFormat::eRGBA;
default: throw std::invalid_argument("Texture format not valid.");
}
}(components);
......@@ -390,10 +394,14 @@ struct Texture
{
switch (components)
{
case 1: return gl::TextureFormat::eRed;
case 2: return gl::TextureFormat::eRG;
case 3: return gl::TextureFormat::eRGB;
case 4: return gl::TextureFormat::eRGBA;
case 1: if constexpr(std::is_same_v<T, int32_t> || std::is_same_v<T, uint32_t>) return gl::TextureFormat::eRedInt;
else return gl::TextureFormat::eRed;
case 2: if constexpr(std::is_same_v<T, int32_t> || std::is_same_v<T, uint32_t>) return gl::TextureFormat::eRGInt;
else return gl::TextureFormat::eRG;
case 3: if constexpr(std::is_same_v<T, int32_t> || std::is_same_v<T, uint32_t>) return gl::TextureFormat::eRGBInt;
else return gl::TextureFormat::eRGB;
case 4: if constexpr(std::is_same_v<T, int32_t> || std::is_same_v<T, uint32_t>) return gl::TextureFormat::eRGBAInt;
else return gl::TextureFormat::eRGBA;
default: throw std::invalid_argument("Texture format not valid.");
}
}(image.components());
......@@ -561,7 +569,8 @@ int main()
{
auto context_id = glare::core::Context::createAsCurrent(files::asset("/preferences/default.xml"));
Image<uint8_t> image_src(files::asset("/textures/bricky.png"));
Image<int> image_src(files::asset("/textures/bricky.png"));
image_src.save(files::asset("/screenshots/bricky_output_direct.png"));
Texture texture(image_src);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment