Browse Source

Add glClipControl extension to glad

master
C. J. Howard 1 year ago
parent
commit
80ed343771
5 changed files with 69 additions and 39 deletions
  1. +40
    -31
      CMakeLists.txt
  2. +1
    -1
      modules/antkeeper-source
  3. +12
    -3
      modules/glad/glad.c
  4. +15
    -3
      modules/glad/glad.h
  5. +1
    -1
      modules/stb/stb_image.c

+ 40
- 31
CMakeLists.txt View File

@ -5,22 +5,34 @@ endif()
cmake_minimum_required(VERSION 3.25) cmake_minimum_required(VERSION 3.25)
set(APPLICATION_NAME "Antkeeper")
set(APPLICATION_VERSION "0.0.1")
set(APPLICATION_AUTHOR "C. J. Howard")
# Slugify application name
string(TOLOWER ${APPLICATION_NAME} APPLICATION_SLUG)
string(REPLACE " " "-" APPLICATION_SLUG ${APPLICATION_SLUG})
# Create superbuild project # Create superbuild project
project(antkeeper-superbuild VERSION "0.0.1")
project(${APPLICATION_SLUG}-superbuild VERSION ${APPLICATION_VERSION})
set(APPLICATION_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
set(APPLICATION_VERSION_MINOR ${PROJECT_VERSION_MINOR})
set(APPLICATION_VERSION_PATCH ${PROJECT_VERSION_PATCH})
# Setup package variables # Setup package variables
set(PACKAGE_NAME ${PROJECT_NAME})
set(PACKAGE_VERSION ${PROJECT_VERSION})
set(PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
set(PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
set(PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
set(PACKAGE_NAME ${APPLICATION_NAME})
set(PACKAGE_VERSION ${APPLICATION_VERSION})
set(PACKAGE_VERSION_MAJOR ${APPLICATION_VERSION_MAJOR})
set(PACKAGE_VERSION_MINOR ${APPLICATION_VERSION_MINOR})
set(PACKAGE_VERSION_PATCH ${APPLICATION_VERSION_PATCH})
get_filename_component(PACKAGE_PLATFORM ${CMAKE_BINARY_DIR} NAME CACHE) get_filename_component(PACKAGE_PLATFORM ${CMAKE_BINARY_DIR} NAME CACHE)
if(CMAKE_BUILD_TYPE STREQUAL "Debug") if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(PACKAGE_BUILD_TYPE debug) set(PACKAGE_BUILD_TYPE debug)
else() else()
set(PACKAGE_BUILD_TYPE release) set(PACKAGE_BUILD_TYPE release)
endif() endif()
set(PACKAGE_FILENAME ${PACKAGE_NAME}-${PACKAGE_VERSION}-${PACKAGE_PLATFORM})
set(PACKAGE_FILENAME ${APPLICATION_SLUG}-${PACKAGE_VERSION}-${PACKAGE_PLATFORM})
set(PACKAGE_INSTALL_DIR ${CMAKE_SOURCE_DIR}/bin/${PACKAGE_BUILD_TYPE}/${PACKAGE_FILENAME}) set(PACKAGE_INSTALL_DIR ${CMAKE_SOURCE_DIR}/bin/${PACKAGE_BUILD_TYPE}/${PACKAGE_FILENAME})
set(PACKAGE_DIST_DIR ${CMAKE_SOURCE_DIR}/dist/${PACKAGE_BUILD_TYPE}) set(PACKAGE_DIST_DIR ${CMAKE_SOURCE_DIR}/dist/${PACKAGE_BUILD_TYPE})
@ -41,30 +53,23 @@ endif()
# Options # Options
set(BLENDER "blender" CACHE FILEPATH "Path to Blender executable") set(BLENDER "blender" CACHE FILEPATH "Path to Blender executable")
set(INKSCAPE "inkscape" CACHE FILEPATH "Path to Inkscape executable")
# Set C++ compiler flags
if(CMAKE_COMPILER_IS_GNUCC)
set(CMAKE_CXX_FLAGS "-Wall -Wextra")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -g")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -O3")
elseif(MSVC)
set(CMAKE_CXX_FLAGS "/MP /W3 /GR- /GS- /EHsc /D_WIN32_WINNT=0x0501 /DWINVER=0x0501")
# Set compiler and linker flags
if(MSVC)
set(CMAKE_CXX_FLAGS "/MP /GR- /GS- /EHsc /D_WIN32_WINNT=0x0501 /DWINVER=0x0501")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} /MTd") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} /MTd")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} /MT /O2") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} /MT /O2")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /nologo")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /OPT:REF /OPT:ICF /INCREMENTAL:NO")
elseif(CMAKE_COMPILER_IS_GNUCC)
set(CMAKE_CXX_FLAGS "")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -g")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -O3")
endif() endif()
# Set C compiler flags
set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS}") set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS}")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") set(CMAKE_C_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") set(CMAKE_C_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
# Set executable linker flags
if(MSVC)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /nologo")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /OPT:REF /OPT:ICF /INCREMENTAL:NO")
endif()
# Setup module directories # Setup module directories
set(MODULE_SOURCE_DIR "${PROJECT_SOURCE_DIR}/modules") set(MODULE_SOURCE_DIR "${PROJECT_SOURCE_DIR}/modules")
set(MODULE_BUILD_DIR "${PROJECT_BINARY_DIR}/modules/build") set(MODULE_BUILD_DIR "${PROJECT_BINARY_DIR}/modules/build")
@ -288,7 +293,9 @@ ExternalProject_Add(antkeeper-source
"-DCMAKE_INSTALL_PREFIX=${PACKAGE_INSTALL_DIR}" "-DCMAKE_INSTALL_PREFIX=${PACKAGE_INSTALL_DIR}"
"-DPACKAGE_PLATFORM=${PACKAGE_PLATFORM}" "-DPACKAGE_PLATFORM=${PACKAGE_PLATFORM}"
"-DCMAKE_PREFIX_PATH=${MODULE_INSTALL_DIR}" "-DCMAKE_PREFIX_PATH=${MODULE_INSTALL_DIR}"
"-DVERSION_STRING=${PROJECT_VERSION}"
"-DAPPLICATION_NAME=${APPLICATION_NAME}"
"-DAPPLICATION_VERSION=${APPLICATION_VERSION}"
"-DAPPLICATION_AUTHOR=${APPLICATION_AUTHOR}"
"-DCMAKE_CXX_FLAGS='${CMAKE_CXX_FLAGS}'" "-DCMAKE_CXX_FLAGS='${CMAKE_CXX_FLAGS}'"
"-DCMAKE_CXX_FLAGS_DEBUG='${CMAKE_CXX_FLAGS_DEBUG}'" "-DCMAKE_CXX_FLAGS_DEBUG='${CMAKE_CXX_FLAGS_DEBUG}'"
"-DCMAKE_CXX_FLAGS_RELEASE='${CMAKE_CXX_FLAGS_RELEASE}'" "-DCMAKE_CXX_FLAGS_RELEASE='${CMAKE_CXX_FLAGS_RELEASE}'"
@ -309,8 +316,10 @@ if(EXISTS ${MODULE_SOURCE_DIR}/antkeeper-data/CMakeLists.txt)
"-DCMAKE_INSTALL_PREFIX=${PACKAGE_INSTALL_DIR}" "-DCMAKE_INSTALL_PREFIX=${PACKAGE_INSTALL_DIR}"
"-DPACKAGE_PLATFORM=${PACKAGE_PLATFORM}" "-DPACKAGE_PLATFORM=${PACKAGE_PLATFORM}"
"-DCMAKE_PREFIX_PATH=${MODULE_INSTALL_DIR}" "-DCMAKE_PREFIX_PATH=${MODULE_INSTALL_DIR}"
"-DAPPLICATION_NAME=${APPLICATION_NAME}"
"-DAPPLICATION_VERSION=${APPLICATION_VERSION}"
"-DAPPLICATION_AUTHOR=${APPLICATION_AUTHOR}"
"-DBLENDER=${BLENDER}" "-DBLENDER=${BLENDER}"
"-DINKSCAPE=${INKSCAPE}"
BUILD_ALWAYS 1) BUILD_ALWAYS 1)
endif() endif()
@ -333,13 +342,13 @@ add_custom_target(cpack
add_custom_target(dist DEPENDS cpack) add_custom_target(dist DEPENDS cpack)
# Configure CPack variables # Configure CPack variables
set(CPACK_PACKAGE_NAME "${PACKAGE_NAME}")
set(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}")
set(CPACK_PACKAGE_FILE_NAME "${PACKAGE_NAME}-${PACKAGE_VERSION}-${PACKAGE_PLATFORM}")
set(CPACK_PACKAGE_NAME "${APPLICATION_NAME}")
set(CPACK_PACKAGE_VERSION_MAJOR "${APPLICATION_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${APPLICATION_VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${APPLICATION_VERSION_PATCH}")
set(CPACK_PACKAGE_FILE_NAME "${APPLICATION_SLUG}-${PACKAGE_VERSION}-${PACKAGE_PLATFORM}")
set(CPACK_PACKAGE_DESCRIPTION "") set(CPACK_PACKAGE_DESCRIPTION "")
set(CPACK_PACKAGE_CONTACT "Christopher J. Howard <cjhoward@cjhoward.org>")
set(CPACK_PACKAGE_CONTACT "${APPLICATION_AUTHOR}")
set(CPACK_COMPONENTS_ALL "package") set(CPACK_COMPONENTS_ALL "package")
# Configure .tgz and .zip distribution packages # Configure .tgz and .zip distribution packages

+ 1
- 1
modules/antkeeper-source

@ -1 +1 @@
Subproject commit 7f9eba6cda91b151ba6db7cfbe2620deccb7f03e
Subproject commit f25e7ce98639a5666aecda993e444c634e03f66d

+ 12
- 3
modules/glad/glad.c View File

@ -1,12 +1,13 @@
/* /*
OpenGL loader generated by glad 0.1.35 on Sun Jun 5 13:01:47 2022.
OpenGL loader generated by glad 0.1.34 on Wed Aug 30 09:51:51 2023.
Language/Generator: C/C++ Language/Generator: C/C++
Specification: gl Specification: gl
APIs: gl=3.3 APIs: gl=3.3
Profile: core Profile: core
Extensions: Extensions:
GL_ARB_clip_control,
GL_EXT_texture_filter_anisotropic GL_EXT_texture_filter_anisotropic
Loader: True Loader: True
Local files: True Local files: True
@ -14,9 +15,9 @@
Reproducible: False Reproducible: False
Commandline: Commandline:
--profile="core" --api="gl=3.3" --generator="c" --spec="gl" --local-files --extensions="GL_EXT_texture_filter_anisotropic"
--profile="core" --api="gl=3.3" --generator="c" --spec="gl" --local-files --extensions="GL_ARB_clip_control,GL_EXT_texture_filter_anisotropic"
Online: Online:
https://glad.dav1d.de/#profile=core&language=c&specification=gl&loader=on&api=gl%3D3.3&extensions=GL_EXT_texture_filter_anisotropic
https://glad.dav1d.de/#profile=core&language=c&specification=gl&loader=on&api=gl%3D3.3&extensions=GL_ARB_clip_control&extensions=GL_EXT_texture_filter_anisotropic
*/ */
#include <stdio.h> #include <stdio.h>
@ -641,7 +642,9 @@ PFNGLVERTEXP4UIPROC glad_glVertexP4ui = NULL;
PFNGLVERTEXP4UIVPROC glad_glVertexP4uiv = NULL; PFNGLVERTEXP4UIVPROC glad_glVertexP4uiv = NULL;
PFNGLVIEWPORTPROC glad_glViewport = NULL; PFNGLVIEWPORTPROC glad_glViewport = NULL;
PFNGLWAITSYNCPROC glad_glWaitSync = NULL; PFNGLWAITSYNCPROC glad_glWaitSync = NULL;
int GLAD_GL_ARB_clip_control = 0;
int GLAD_GL_EXT_texture_filter_anisotropic = 0; int GLAD_GL_EXT_texture_filter_anisotropic = 0;
PFNGLCLIPCONTROLPROC glad_glClipControl = NULL;
static void load_GL_VERSION_1_0(GLADloadproc load) { static void load_GL_VERSION_1_0(GLADloadproc load) {
if(!GLAD_GL_VERSION_1_0) return; if(!GLAD_GL_VERSION_1_0) return;
glad_glCullFace = (PFNGLCULLFACEPROC)load("glCullFace"); glad_glCullFace = (PFNGLCULLFACEPROC)load("glCullFace");
@ -1055,8 +1058,13 @@ static void load_GL_VERSION_3_3(GLADloadproc load) {
glad_glSecondaryColorP3ui = (PFNGLSECONDARYCOLORP3UIPROC)load("glSecondaryColorP3ui"); glad_glSecondaryColorP3ui = (PFNGLSECONDARYCOLORP3UIPROC)load("glSecondaryColorP3ui");
glad_glSecondaryColorP3uiv = (PFNGLSECONDARYCOLORP3UIVPROC)load("glSecondaryColorP3uiv"); glad_glSecondaryColorP3uiv = (PFNGLSECONDARYCOLORP3UIVPROC)load("glSecondaryColorP3uiv");
} }
static void load_GL_ARB_clip_control(GLADloadproc load) {
if(!GLAD_GL_ARB_clip_control) return;
glad_glClipControl = (PFNGLCLIPCONTROLPROC)load("glClipControl");
}
static int find_extensionsGL(void) { static int find_extensionsGL(void) {
if (!get_exts()) return 0; if (!get_exts()) return 0;
GLAD_GL_ARB_clip_control = has_ext("GL_ARB_clip_control");
GLAD_GL_EXT_texture_filter_anisotropic = has_ext("GL_EXT_texture_filter_anisotropic"); GLAD_GL_EXT_texture_filter_anisotropic = has_ext("GL_EXT_texture_filter_anisotropic");
free_exts(); free_exts();
return 1; return 1;
@ -1136,6 +1144,7 @@ int gladLoadGLLoader(GLADloadproc load) {
load_GL_VERSION_3_3(load); load_GL_VERSION_3_3(load);
if (!find_extensionsGL()) return 0; if (!find_extensionsGL()) return 0;
load_GL_ARB_clip_control(load);
return GLVersion.major != 0 || GLVersion.minor != 0; return GLVersion.major != 0 || GLVersion.minor != 0;
} }

+ 15
- 3
modules/glad/glad.h View File

@ -1,12 +1,13 @@
/* /*
OpenGL loader generated by glad 0.1.35 on Sun Jun 5 13:01:47 2022.
OpenGL loader generated by glad 0.1.34 on Wed Aug 30 09:51:51 2023.
Language/Generator: C/C++ Language/Generator: C/C++
Specification: gl Specification: gl
APIs: gl=3.3 APIs: gl=3.3
Profile: core Profile: core
Extensions: Extensions:
GL_ARB_clip_control,
GL_EXT_texture_filter_anisotropic GL_EXT_texture_filter_anisotropic
Loader: True Loader: True
Local files: True Local files: True
@ -14,9 +15,9 @@
Reproducible: False Reproducible: False
Commandline: Commandline:
--profile="core" --api="gl=3.3" --generator="c" --spec="gl" --local-files --extensions="GL_EXT_texture_filter_anisotropic"
--profile="core" --api="gl=3.3" --generator="c" --spec="gl" --local-files --extensions="GL_ARB_clip_control,GL_EXT_texture_filter_anisotropic"
Online: Online:
https://glad.dav1d.de/#profile=core&language=c&specification=gl&loader=on&api=gl%3D3.3&extensions=GL_EXT_texture_filter_anisotropic
https://glad.dav1d.de/#profile=core&language=c&specification=gl&loader=on&api=gl%3D3.3&extensions=GL_ARB_clip_control&extensions=GL_EXT_texture_filter_anisotropic
*/ */
@ -2121,8 +2122,19 @@ typedef void (APIENTRYP PFNGLSECONDARYCOLORP3UIVPROC)(GLenum type, const GLuint
GLAPI PFNGLSECONDARYCOLORP3UIVPROC glad_glSecondaryColorP3uiv; GLAPI PFNGLSECONDARYCOLORP3UIVPROC glad_glSecondaryColorP3uiv;
#define glSecondaryColorP3uiv glad_glSecondaryColorP3uiv #define glSecondaryColorP3uiv glad_glSecondaryColorP3uiv
#endif #endif
#define GL_NEGATIVE_ONE_TO_ONE 0x935E
#define GL_ZERO_TO_ONE 0x935F
#define GL_CLIP_ORIGIN 0x935C
#define GL_CLIP_DEPTH_MODE 0x935D
#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE #define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF #define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
#ifndef GL_ARB_clip_control
#define GL_ARB_clip_control 1
GLAPI int GLAD_GL_ARB_clip_control;
typedef void (APIENTRYP PFNGLCLIPCONTROLPROC)(GLenum origin, GLenum depth);
GLAPI PFNGLCLIPCONTROLPROC glad_glClipControl;
#define glClipControl glad_glClipControl
#endif
#ifndef GL_EXT_texture_filter_anisotropic #ifndef GL_EXT_texture_filter_anisotropic
#define GL_EXT_texture_filter_anisotropic 1 #define GL_EXT_texture_filter_anisotropic 1
GLAPI int GLAD_GL_EXT_texture_filter_anisotropic; GLAPI int GLAD_GL_EXT_texture_filter_anisotropic;

+ 1
- 1
modules/stb/stb_image.c View File

@ -6,7 +6,7 @@
#define STBI_NO_HDR #define STBI_NO_HDR
#define STBI_NO_PIC #define STBI_NO_PIC
#define STBI_NO_PNM #define STBI_NO_PNM
#define STBI_NO_FAILURE_STRINGS
//#define STBI_NO_FAILURE_STRINGS
#define STBI_NO_LINEAR #define STBI_NO_LINEAR
#define STBI_NO_STDIO #define STBI_NO_STDIO

Loading…
Cancel
Save