Compare commits
2
Commits
v1.2.4
..
a925bce314
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a925bce314 | ||
|
|
6bf73705c2 |
@@ -39,6 +39,7 @@ build-no-video:
|
|||||||
-lm -lGL -lglfw -lasound \
|
-lm -lGL -lglfw -lasound \
|
||||||
-Wall -Wextra \
|
-Wall -Wextra \
|
||||||
-Wno-format-truncation \
|
-Wno-format-truncation \
|
||||||
|
-Wno-unused-parameter \
|
||||||
-DGLFW_INCLUDE_NONE \
|
-DGLFW_INCLUDE_NONE \
|
||||||
-DGLFW_NATIVE_INCLUDE_NONE \
|
-DGLFW_NATIVE_INCLUDE_NONE \
|
||||||
-DLOG_USE_COLOR \
|
-DLOG_USE_COLOR \
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
pkgname=forge-steel
|
pkgname=forge-steel
|
||||||
pkgver=1.2.4
|
pkgver=1.2.0
|
||||||
pkgrel=1
|
pkgrel=1
|
||||||
pkgdesc="Fusion Of Real Time Generative Effects"
|
pkgdesc="Fusion Of Real Time Generative Effects"
|
||||||
arch=('i686' 'pentium4' 'x86_64' 'arm' 'armv7h' 'armv6h' 'aarch64' 'riscv64')
|
arch=('i686' 'pentium4' 'x86_64' 'arm' 'armv7h' 'armv6h' 'aarch64' 'riscv64')
|
||||||
depends=('glfw>=1:3', 'v4l-utils>=1.32', 'alsa-lib>=1.2', 'libglvnd>=1.7')
|
depends=('glfw>=1:3', 'v4l-utils>=1.32', 'alsa-lib>=1.2', 'libglvnd>=1.7')
|
||||||
url="https://git.klemek.fr/klemek/forge-steel"
|
url="https://git.klemek.fr/klemek/forge-steel"
|
||||||
source=("${pkgname}-steel-${pkgver}.tar.gz::https://git.klemek.fr/klemek/forge-steel/releases/download/v${pkgver}/${pkgname}-${pkgver}.tar.gz")
|
source=("${pkgname}-steel-${pkgver}.tar.gz::https://git.klemek.fr/klemek/forge-steel/releases/download/v${pkgver}/${pkgname}-${pkgver}.tar.gz")
|
||||||
sha256sums=('a34c7f8101d8d947e26bee1fa5ab8d87f4292014e5ef17d03eb34fefb387db9e')
|
sha256sums=('b04e9159eb3eb809029bf02423e4bf844ecdb3b11cbcb49d8eed8f2505d32a1f')
|
||||||
srcdir=build
|
srcdir=build
|
||||||
backup=("usr/share/${pkgname}")
|
backup=("usr/share/${pkgname}")
|
||||||
|
|
||||||
|
|||||||
@@ -273,18 +273,6 @@ See the [printable version](./docs/forge_default_mapping.pdf).
|
|||||||
| <kbd>Ctrl</kbd> + <kbd>M</kbd> | Projection mapping 3 |
|
| <kbd>Ctrl</kbd> + <kbd>M</kbd> | Projection mapping 3 |
|
||||||
| <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>M</kbd> | Projection mapping 4 |
|
| <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>M</kbd> | Projection mapping 4 |
|
||||||
|
|
||||||
### Projection Mappings
|
|
||||||
|
|
||||||
In any of the projection mapping mode, use the nanoKONTROL2 last 4 columns to control 4 on-screen points:
|
|
||||||
|
|
||||||
| Midi Control | Function |
|
|
||||||
| ------ | -------- |
|
|
||||||
| Fader N | point N - X position |
|
|
||||||
| Knob N | point N - Y position |
|
|
||||||
| Last column top button | activate projection mapping |
|
|
||||||
| Last column middle button | invert projection mapping |
|
|
||||||
| Last column bottom button | show projection borders |
|
|
||||||
|
|
||||||
## Making your own FORGE project
|
## Making your own FORGE project
|
||||||
|
|
||||||
You want to embrace the "user" in "user-defined"? It's time to make your own project.
|
You want to embrace the "user" in "user-defined"? It's time to make your own project.
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
AC_INIT([forge], [steel-1.2.4], [klemek.dev@proton.me])
|
AC_INIT([forge], [steel-1.2.0], [klemek.dev@proton.me])
|
||||||
AM_INIT_AUTOMAKE
|
AM_INIT_AUTOMAKE
|
||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
|
|
||||||
|
|||||||
+12
-12
@@ -279,9 +279,9 @@ GROUP_3_2_Z=11089
|
|||||||
ARI_COUNT=62
|
ARI_COUNT=62
|
||||||
ARI_1=GROUP_3_1_Y
|
ARI_1=GROUP_3_1_Y
|
||||||
ARI_2=GROUP_3_2_Z
|
ARI_2=GROUP_3_2_Z
|
||||||
ARI_3=GROUP_2_5_X_4
|
ARI_3=GROUP_2_1_X_4
|
||||||
ARI_4=GROUP_2_5_Y_4
|
ARI_4=GROUP_2_1_Y_4
|
||||||
ARI_5=GROUP_2_5_Z_4
|
ARI_5=GROUP_2_1_Z_4
|
||||||
ARI_6=GROUP_2_2_X_4
|
ARI_6=GROUP_2_2_X_4
|
||||||
ARI_7=GROUP_2_2_Y_4
|
ARI_7=GROUP_2_2_Y_4
|
||||||
ARI_8=GROUP_2_2_Z_4
|
ARI_8=GROUP_2_2_Z_4
|
||||||
@@ -294,9 +294,9 @@ ARI_14=GROUP_2_6_Z_4
|
|||||||
ARI_15=GROUP_2_7_X_4
|
ARI_15=GROUP_2_7_X_4
|
||||||
ARI_16=GROUP_2_7_Y_4
|
ARI_16=GROUP_2_7_Y_4
|
||||||
ARI_17=GROUP_2_7_Z_4
|
ARI_17=GROUP_2_7_Z_4
|
||||||
ARI_18=GROUP_2_5_X_5
|
ARI_18=GROUP_2_1_X_5
|
||||||
ARI_19=GROUP_2_5_Y_5
|
ARI_19=GROUP_2_1_Y_5
|
||||||
ARI_20=GROUP_2_5_Z_5
|
ARI_20=GROUP_2_1_Z_5
|
||||||
ARI_21=GROUP_2_2_X_5
|
ARI_21=GROUP_2_2_X_5
|
||||||
ARI_22=GROUP_2_2_Y_5
|
ARI_22=GROUP_2_2_Y_5
|
||||||
ARI_23=GROUP_2_2_Z_5
|
ARI_23=GROUP_2_2_Z_5
|
||||||
@@ -309,9 +309,9 @@ ARI_29=GROUP_2_6_Z_5
|
|||||||
ARI_30=GROUP_2_7_X_5
|
ARI_30=GROUP_2_7_X_5
|
||||||
ARI_31=GROUP_2_7_Y_5
|
ARI_31=GROUP_2_7_Y_5
|
||||||
ARI_32=GROUP_2_7_Z_5
|
ARI_32=GROUP_2_7_Z_5
|
||||||
ARI_33=GROUP_2_5_X_6
|
ARI_33=GROUP_2_1_X_6
|
||||||
ARI_34=GROUP_2_5_Y_6
|
ARI_34=GROUP_2_1_Y_6
|
||||||
ARI_35=GROUP_2_5_Z_6
|
ARI_35=GROUP_2_1_Z_6
|
||||||
ARI_36=GROUP_2_2_X_6
|
ARI_36=GROUP_2_2_X_6
|
||||||
ARI_37=GROUP_2_2_Y_6
|
ARI_37=GROUP_2_2_Y_6
|
||||||
ARI_38=GROUP_2_2_Z_6
|
ARI_38=GROUP_2_2_Z_6
|
||||||
@@ -324,9 +324,9 @@ ARI_44=GROUP_2_6_Z_6
|
|||||||
ARI_45=GROUP_2_7_X_6
|
ARI_45=GROUP_2_7_X_6
|
||||||
ARI_46=GROUP_2_7_Y_6
|
ARI_46=GROUP_2_7_Y_6
|
||||||
ARI_47=GROUP_2_7_Z_6
|
ARI_47=GROUP_2_7_Z_6
|
||||||
ARI_48=GROUP_2_5_X_7
|
ARI_48=GROUP_2_1_X_7
|
||||||
ARI_49=GROUP_2_5_Y_7
|
ARI_49=GROUP_2_1_Y_7
|
||||||
ARI_50=GROUP_2_5_Z_7
|
ARI_50=GROUP_2_1_Z_7
|
||||||
ARI_51=GROUP_2_2_X_7
|
ARI_51=GROUP_2_2_X_7
|
||||||
ARI_52=GROUP_2_2_Y_7
|
ARI_52=GROUP_2_2_Y_7
|
||||||
ARI_53=GROUP_2_2_Z_7
|
ARI_53=GROUP_2_2_Z_7
|
||||||
|
|||||||
+7
-7
@@ -15,14 +15,14 @@ uniform vec3 iGroup2_6[7];
|
|||||||
uniform vec3 iGroup2_7[7];
|
uniform vec3 iGroup2_7[7];
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
bool visible = (iGroup2_4[4].x + iGroup2_5[4].x + iGroup2_6[4].x + iGroup2_7[4].x) > 0;
|
bool visible = (iGroup2_4[0].x + iGroup2_5[0].x + iGroup2_6[0].x + iGroup2_7[0].x) > 0;
|
||||||
bool invert = (iGroup2_4[4].y + iGroup2_5[4].y + iGroup2_6[4].y + iGroup2_7[4].y) > 0;
|
bool invert = (iGroup2_4[0].y + iGroup2_5[0].y + iGroup2_6[0].y + iGroup2_7[0].y) > 0;
|
||||||
float rect = clamp(iGroup2_4[4].z + iGroup2_5[4].z + iGroup2_6[4].z + iGroup2_7[4].z, 0, 1);
|
float rect = clamp(iGroup2_4[0].z + iGroup2_5[0].z + iGroup2_6[0].z + iGroup2_7[0].z, 0, 1);
|
||||||
bool modified = false;
|
bool modified = false;
|
||||||
|
|
||||||
vec2 uv = mix(vec2(0), vUV, base_mask(vUV));
|
vec2 uv = mix(vec2(0), vUV, base_mask(vUV));
|
||||||
|
|
||||||
if (iGroup2_4[4].x > 0) {
|
if (iGroup2_4[0].x > 0) {
|
||||||
vec2 p11 = vec2(iGroup2_4[6].xy);
|
vec2 p11 = vec2(iGroup2_4[6].xy);
|
||||||
vec2 p12 = vec2(iGroup2_4[1].xy);
|
vec2 p12 = vec2(iGroup2_4[1].xy);
|
||||||
vec2 p13 = vec2(iGroup2_4[3].xy);
|
vec2 p13 = vec2(iGroup2_4[3].xy);
|
||||||
@@ -39,7 +39,7 @@ void main() {
|
|||||||
modified = true;
|
modified = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (iGroup2_5[4].x > 0) {
|
if (iGroup2_5[0].x > 0) {
|
||||||
vec2 p21 = vec2(iGroup2_5[6].xy);
|
vec2 p21 = vec2(iGroup2_5[6].xy);
|
||||||
vec2 p22 = vec2(iGroup2_5[1].xy);
|
vec2 p22 = vec2(iGroup2_5[1].xy);
|
||||||
vec2 p23 = vec2(iGroup2_5[3].xy);
|
vec2 p23 = vec2(iGroup2_5[3].xy);
|
||||||
@@ -60,7 +60,7 @@ void main() {
|
|||||||
modified = true;
|
modified = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (iGroup2_6[4].x > 0) {
|
if (iGroup2_6[0].x > 0) {
|
||||||
vec2 p31 = vec2(iGroup2_6[6].xy);
|
vec2 p31 = vec2(iGroup2_6[6].xy);
|
||||||
vec2 p32 = vec2(iGroup2_6[1].xy);
|
vec2 p32 = vec2(iGroup2_6[1].xy);
|
||||||
vec2 p33 = vec2(iGroup2_6[3].xy);
|
vec2 p33 = vec2(iGroup2_6[3].xy);
|
||||||
@@ -81,7 +81,7 @@ void main() {
|
|||||||
modified = true;
|
modified = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (iGroup2_7[4].x > 0) {
|
if (iGroup2_7[0].x > 0) {
|
||||||
vec2 p41 = vec2(iGroup2_7[6].xy);
|
vec2 p41 = vec2(iGroup2_7[6].xy);
|
||||||
vec2 p42 = vec2(iGroup2_7[1].xy);
|
vec2 p42 = vec2(iGroup2_7[1].xy);
|
||||||
vec2 p43 = vec2(iGroup2_7[3].xy);
|
vec2 p43 = vec2(iGroup2_7[3].xy);
|
||||||
|
|||||||
+1
-41
@@ -11,9 +11,6 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
|
|
||||||
#define STR_IMPL_(x) #x // stringify argument
|
|
||||||
#define STR(x) STR_IMPL_(x) // indirection to expand argument macros
|
|
||||||
|
|
||||||
static void print_help(int status_code) {
|
static void print_help(int status_code) {
|
||||||
puts(
|
puts(
|
||||||
PACKAGE
|
PACKAGE
|
||||||
@@ -45,12 +42,6 @@ static void print_help(int status_code) {
|
|||||||
"[-mr / -nmr] "
|
"[-mr / -nmr] "
|
||||||
"[-tm] "
|
"[-tm] "
|
||||||
"[-tf] "
|
"[-tf] "
|
||||||
"[--x11] "
|
|
||||||
"[--wayland] "
|
|
||||||
"[--cocoa] "
|
|
||||||
"[--win32] "
|
|
||||||
"[-oma=MAJOR] "
|
|
||||||
"[-omi=MINOR] "
|
|
||||||
"\n\n"
|
"\n\n"
|
||||||
"Fusion Of Real-time Generative Effects.\n\n"
|
"Fusion Of Real-time Generative Effects.\n\n"
|
||||||
"options:\n"
|
"options:\n"
|
||||||
@@ -90,17 +81,7 @@ static void print_help(int status_code) {
|
|||||||
" -mr, --midi-reconnect auto-reconnect midi (default)\n"
|
" -mr, --midi-reconnect auto-reconnect midi (default)\n"
|
||||||
" -nmr, --no-midi-reconnect do not auto-reconnect midi\n"
|
" -nmr, --no-midi-reconnect do not auto-reconnect midi\n"
|
||||||
" -tm, --trace-midi print midi code and values\n"
|
" -tm, --trace-midi print midi code and values\n"
|
||||||
" -tf, --trace-fps print fps status of subsystems\n"
|
" -tf, --trace-fps print fps status of subsystems\n");
|
||||||
" --x11 force X11 GLFW backend\n"
|
|
||||||
" --wayland force Wayland GLFW backend\n"
|
|
||||||
" --cocoa force Cocoa GLFW backend\n"
|
|
||||||
" --win32 force Win32 GLFW backend\n"
|
|
||||||
" -oma, --opengl-major-version OpenGL major version "
|
|
||||||
"(default: " STR(
|
|
||||||
OPENGL_MAJOR_VERSION) ")\n"
|
|
||||||
" -omi, --opengl-minor-version OpenGL "
|
|
||||||
"minor version (default: " STR(
|
|
||||||
OPENGL_MINOR_VERSION) ")\n");
|
|
||||||
exit(status_code);
|
exit(status_code);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,9 +152,6 @@ void args_parse(Parameters *params, int argc, char **argv) {
|
|||||||
params->midi_reconnect = true;
|
params->midi_reconnect = true;
|
||||||
params->trace_midi = false;
|
params->trace_midi = false;
|
||||||
params->trace_fps = false;
|
params->trace_fps = false;
|
||||||
params->glfw_backend = GLFW_BACKEND_ANY;
|
|
||||||
params->opengl_major = OPENGL_MAJOR_VERSION;
|
|
||||||
params->opengl_minor = OPENGL_MINOR_VERSION;
|
|
||||||
|
|
||||||
for (int i = 1; i < argc; i++) {
|
for (int i = 1; i < argc; i++) {
|
||||||
arg = argv[i];
|
arg = argv[i];
|
||||||
@@ -242,24 +220,6 @@ void args_parse(Parameters *params, int argc, char **argv) {
|
|||||||
params->trace_midi = true;
|
params->trace_midi = true;
|
||||||
} else if (is_arg(arg, "-tf") || is_arg(arg, "--trace-fps")) {
|
} else if (is_arg(arg, "-tf") || is_arg(arg, "--trace-fps")) {
|
||||||
params->trace_fps = true;
|
params->trace_fps = true;
|
||||||
} else if (is_arg(arg, "--x11")) {
|
|
||||||
params->glfw_backend = GLFW_BACKEND_X11;
|
|
||||||
} else if (is_arg(arg, "--wayland")) {
|
|
||||||
params->glfw_backend = GLFW_BACKEND_WAYLAND;
|
|
||||||
} else if (is_arg(arg, "--cocoa")) {
|
|
||||||
params->glfw_backend = GLFW_BACKEND_COCOA;
|
|
||||||
} else if (is_arg(arg, "--win32")) {
|
|
||||||
params->glfw_backend = GLFW_BACKEND_WIN32;
|
|
||||||
} else if (is_arg(arg, "-oma") || is_arg(arg, "--opengl-major-version")) {
|
|
||||||
params->opengl_major = parse_uint(arg, value);
|
|
||||||
if (params->opengl_major == 0) {
|
|
||||||
invalid_value(arg, value);
|
|
||||||
}
|
|
||||||
} else if (is_arg(arg, "-omi") || is_arg(arg, "--opengl-minor-version")) {
|
|
||||||
params->opengl_minor = parse_uint(arg, value);
|
|
||||||
if (params->opengl_major == 0) {
|
|
||||||
invalid_value(arg, value);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
#ifdef VIDEO_IN
|
#ifdef VIDEO_IN
|
||||||
if (is_arg(arg, "-vi") || is_arg(arg, "--video-in")) {
|
if (is_arg(arg, "-vi") || is_arg(arg, "--video-in")) {
|
||||||
|
|||||||
@@ -87,23 +87,4 @@
|
|||||||
#define MAX_TAP_VALUES 10
|
#define MAX_TAP_VALUES 10
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* OPENGL */
|
|
||||||
|
|
||||||
#ifndef OPENGL_MAJOR_VERSION
|
|
||||||
#define OPENGL_MAJOR_VERSION 4
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef OPENGL_MINOR_VERSION
|
|
||||||
#define OPENGL_MINOR_VERSION 6
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* GLFW CONSTANTS */
|
|
||||||
#ifndef GLFW_BACKENDS
|
|
||||||
#define GLFW_BACKEND_ANY 0
|
|
||||||
#define GLFW_BACKEND_X11 1
|
|
||||||
#define GLFW_BACKEND_WAYLAND 2
|
|
||||||
#define GLFW_BACKEND_COCOA 3
|
|
||||||
#define GLFW_BACKEND_WIN32 4
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* CONFIG_H */
|
#endif /* CONFIG_H */
|
||||||
|
|||||||
+3
-5
@@ -286,15 +286,14 @@ static bool init(const Parameters *params) {
|
|||||||
|
|
||||||
start_state_background_write();
|
start_state_background_write();
|
||||||
|
|
||||||
window_startup(error_callback, params->glfw_backend);
|
window_startup(error_callback);
|
||||||
|
|
||||||
context.tex_resolution[0] = params->internal_size;
|
context.tex_resolution[0] = params->internal_size;
|
||||||
context.tex_resolution[1] = params->internal_size;
|
context.tex_resolution[1] = params->internal_size;
|
||||||
|
|
||||||
if (params->output) {
|
if (params->output) {
|
||||||
window_output = window_init(PACKAGE " " VERSION, params->output_screen,
|
window_output = window_init(PACKAGE " " VERSION, params->output_screen,
|
||||||
params->windowed, params->opengl_major,
|
params->windowed, NULL, key_callback);
|
||||||
params->opengl_minor, NULL, key_callback);
|
|
||||||
|
|
||||||
window_use(window_output, &context);
|
window_use(window_output, &context);
|
||||||
|
|
||||||
@@ -306,8 +305,7 @@ static bool init(const Parameters *params) {
|
|||||||
if (params->monitor) {
|
if (params->monitor) {
|
||||||
window_monitor =
|
window_monitor =
|
||||||
window_init(PACKAGE " " VERSION " (monitor)", params->monitor_screen,
|
window_init(PACKAGE " " VERSION " (monitor)", params->monitor_screen,
|
||||||
params->windowed, params->opengl_major,
|
params->windowed, window_output, key_callback);
|
||||||
params->opengl_minor, window_output, key_callback);
|
|
||||||
|
|
||||||
window_use(window_monitor, &context);
|
window_use(window_monitor, &context);
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -60,7 +60,7 @@ static void gl_debug_callback(GLenum source, GLenum type, GLuint id,
|
|||||||
|
|
||||||
#endif /* GL_DEBUG */
|
#endif /* GL_DEBUG */
|
||||||
|
|
||||||
static bool check_eglerror_ro(__attribute__((unused)) const char *context) {
|
static bool check_eglerror_ro(const char *context) {
|
||||||
#ifdef VIDEO_IN
|
#ifdef VIDEO_IN
|
||||||
unsigned int code;
|
unsigned int code;
|
||||||
|
|
||||||
|
|||||||
@@ -58,9 +58,6 @@ typedef struct Parameters {
|
|||||||
bool midi_reconnect;
|
bool midi_reconnect;
|
||||||
bool trace_midi;
|
bool trace_midi;
|
||||||
bool trace_fps;
|
bool trace_fps;
|
||||||
unsigned int glfw_backend;
|
|
||||||
unsigned int opengl_major;
|
|
||||||
unsigned int opengl_minor;
|
|
||||||
} Parameters;
|
} Parameters;
|
||||||
|
|
||||||
// file.c
|
// file.c
|
||||||
|
|||||||
+8
-40
@@ -7,8 +7,7 @@
|
|||||||
|
|
||||||
#include "window.h"
|
#include "window.h"
|
||||||
|
|
||||||
static void init_glfw(void (*error_callback)(int, const char *),
|
static void init_glfw(void (*error_callback)(int, const char *)) {
|
||||||
const unsigned int backend) {
|
|
||||||
log_info("[GLFW] Initializing...");
|
log_info("[GLFW] Initializing...");
|
||||||
|
|
||||||
// set errors handler
|
// set errors handler
|
||||||
@@ -17,30 +16,6 @@ static void init_glfw(void (*error_callback)(int, const char *),
|
|||||||
// print current GLFW version
|
// print current GLFW version
|
||||||
log_info("[GLFW] %s", glfwGetVersionString());
|
log_info("[GLFW] %s", glfwGetVersionString());
|
||||||
|
|
||||||
switch (backend) {
|
|
||||||
#ifdef GLFW_PLATFORM
|
|
||||||
case GLFW_BACKEND_X11:
|
|
||||||
glfwInitHint(GLFW_PLATFORM, GLFW_PLATFORM_X11);
|
|
||||||
log_info("[GLFW] platform: X11");
|
|
||||||
break;
|
|
||||||
case GLFW_BACKEND_WAYLAND:
|
|
||||||
glfwInitHint(GLFW_PLATFORM, GLFW_PLATFORM_WAYLAND);
|
|
||||||
log_info("[GLFW] platform: Wayland");
|
|
||||||
break;
|
|
||||||
case GLFW_BACKEND_COCOA:
|
|
||||||
glfwInitHint(GLFW_PLATFORM, GLFW_PLATFORM_COCOA);
|
|
||||||
log_info("[GLFW] platform: Cocoa");
|
|
||||||
break;
|
|
||||||
case GLFW_BACKEND_WIN32:
|
|
||||||
glfwInitHint(GLFW_PLATFORM, GLFW_BACKEND_WIN32);
|
|
||||||
log_info("[GLFW] platform: Win32");
|
|
||||||
break;
|
|
||||||
#endif /* GLFW_PLATFORM */
|
|
||||||
default:
|
|
||||||
log_info("[GLFW] platform: Any");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// init GLFW
|
// init GLFW
|
||||||
if (!glfwInit()) {
|
if (!glfwInit()) {
|
||||||
log_error("[GLFW] Initialization failed");
|
log_error("[GLFW] Initialization failed");
|
||||||
@@ -69,9 +44,7 @@ static GLFWmonitor *get_monitor(unsigned char monitor_index) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static GLFWwindow *
|
static GLFWwindow *
|
||||||
create_window(GLFWmonitor *monitor, const char *title,
|
create_window(GLFWmonitor *monitor, const char *title, Window *shared_context,
|
||||||
const unsigned int opengl_major, const unsigned int opengl_minor,
|
|
||||||
Window *shared_context,
|
|
||||||
void (*key_callback)(Window *, int, int, int, int)) {
|
void (*key_callback)(Window *, int, int, int, int)) {
|
||||||
GLFWwindow *window;
|
GLFWwindow *window;
|
||||||
|
|
||||||
@@ -84,8 +57,8 @@ create_window(GLFWmonitor *monitor, const char *title,
|
|||||||
glfwWindowHint(GLFW_FOCUS_ON_SHOW, GLFW_FALSE);
|
glfwWindowHint(GLFW_FOCUS_ON_SHOW, GLFW_FALSE);
|
||||||
|
|
||||||
// Context related hints
|
// Context related hints
|
||||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, opengl_major);
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
|
||||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, opengl_minor);
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 6);
|
||||||
#ifdef GL_DEBUG
|
#ifdef GL_DEBUG
|
||||||
glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, GLFW_TRUE);
|
glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, GLFW_TRUE);
|
||||||
#endif
|
#endif
|
||||||
@@ -113,9 +86,8 @@ create_window(GLFWmonitor *monitor, const char *title,
|
|||||||
|
|
||||||
static void use_window(GLFWwindow *window) { glfwMakeContextCurrent(window); }
|
static void use_window(GLFWwindow *window) { glfwMakeContextCurrent(window); }
|
||||||
|
|
||||||
void window_startup(void (*error_callback)(int, const char *),
|
void window_startup(void (*error_callback)(int, const char *)) {
|
||||||
const unsigned int backend) {
|
init_glfw(error_callback);
|
||||||
init_glfw(error_callback, backend);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void window_terminate() {
|
void window_terminate() {
|
||||||
@@ -124,21 +96,17 @@ void window_terminate() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Window *window_init(const char *title, unsigned char monitor_index,
|
Window *window_init(const char *title, unsigned char monitor_index,
|
||||||
bool windowed, const unsigned int opengl_major,
|
bool windowed, Window *shared_context,
|
||||||
const unsigned int opengl_minor, Window *shared_context,
|
|
||||||
void (*key_callback)(Window *, int, int, int, int)) {
|
void (*key_callback)(Window *, int, int, int, int)) {
|
||||||
GLFWwindow *window;
|
GLFWwindow *window;
|
||||||
GLFWmonitor *monitor;
|
GLFWmonitor *monitor;
|
||||||
|
|
||||||
monitor = windowed ? NULL : get_monitor(monitor_index);
|
monitor = windowed ? NULL : get_monitor(monitor_index);
|
||||||
|
|
||||||
window = create_window(monitor, title, opengl_major, opengl_minor,
|
window = create_window(monitor, title, shared_context, key_callback);
|
||||||
shared_context, key_callback);
|
|
||||||
|
|
||||||
use_window(window);
|
use_window(window);
|
||||||
|
|
||||||
glfwSwapInterval(0);
|
|
||||||
|
|
||||||
return window;
|
return window;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-3
@@ -3,13 +3,12 @@
|
|||||||
#ifndef WINDOW_H
|
#ifndef WINDOW_H
|
||||||
#define WINDOW_H
|
#define WINDOW_H
|
||||||
|
|
||||||
void window_startup(void (*error_callback)(int, const char *), const unsigned int backend);
|
void window_startup(void (*error_callback)(int, const char *));
|
||||||
|
|
||||||
void window_terminate();
|
void window_terminate();
|
||||||
|
|
||||||
Window *window_init(const char *title, unsigned char monitor_index,
|
Window *window_init(const char *title, unsigned char monitor_index,
|
||||||
bool windowed, const unsigned int opengl_major,
|
bool windowed, Window *shared_context,
|
||||||
const unsigned int opengl_minor, Window *shared_context,
|
|
||||||
void (*key_callback)(Window *, int, int, int, int));
|
void (*key_callback)(Window *, int, int, int, int));
|
||||||
|
|
||||||
void window_update_title(Window *window, const char *title);
|
void window_update_title(Window *window, const char *title);
|
||||||
|
|||||||
Reference in New Issue
Block a user