-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
made linking with libc the default, as it's the most commonly used mode
- Loading branch information
Showing
4 changed files
with
49 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,9 +24,12 @@ A second reason to use MiniGLUT is to ease porting of UNIX OpenGL programs to | |
Windows, especially when using the microsoft compiler, where setting up and | ||
linking with a proper 3rd-party library is an ordeal in itself. Even more so if | ||
you decide to statically link, at which point you need to deal with the whole | ||
"MSVC runtime" chaos. Even if you decide to link MiniGLUT as a static library, | ||
instead of dropping it in your code, it still won't present any MSVC runtime | ||
compatibility issues, since it doesn't call any C library functions whatsoever. | ||
"MSVC runtime" chaos. | ||
|
||
On GNU/Linux x86/x86-64 and 32bit Windows, MiniGLUT can be compiled to never | ||
call any C library functions whatsoever (which is the default if you use the | ||
included makefile/msvc project to build a static library). This is useful to | ||
avoid dependencies on any specific libc or msvc runtime. | ||
|
||
Download | ||
-------- | ||
|
@@ -50,15 +53,27 @@ When building with MSVC, linking with the correct libraries is taken care by | |
pragmas in the header file. If you wish to avoid the winmm dependency, define | ||
`MINIGLUT_NO_WINMM`. | ||
|
||
To disable calling any C library functions, make sure to have `MINIGLUT_NO_LIBC` | ||
defined when building `miniglut.c`. Either add that to your build system, or | ||
just modify `miniglut.c` and define it at the top. | ||
|
||
> Note: in previous versions (including v0.5), building without libc was the | ||
> default, and you had to define `MINIGLUT_USE_LIBC` to make it use libc. But | ||
> it turns out usually when you're building miniglut as part of your project, | ||
> there's no real downside to using libc in most use cases, so I decided to | ||
> change the default, and have the extra define go to the static library build | ||
> files instead of *every* project which drops `miniglut.h`/`miniglut.c` in the | ||
> source tree. | ||
To avoid calling C library functions, MiniGLUT uses inline assembly code for | ||
system calls and trigonometric operations. This makes the default build | ||
incompatible with non-x86 systems, and with MSVC x64 builds. If you don't mind | ||
linking with the C library, you can define `MINIGLUT_USE_LIBC` to lift these | ||
limitations. | ||
system calls and trigonometric operations. This is currently implemented only | ||
on x86 (32 and 64bit), and only on 32bit when building with MSVC (which doesn't | ||
support inline assembly on x86-64). For all other systems you need to link with | ||
libc. | ||
|
||
License | ||
------- | ||
Copyright (C) 2020-2022 John Tsiombikas <[email protected]> | ||
Copyright (C) 2020-2024 John Tsiombikas <[email protected]> | ||
|
||
MiniGLUT is free software. Feel free to use, modify and/or redistribute it, | ||
under the terms of the GNU General Public License v3, or at your option any | ||
|
@@ -74,6 +89,19 @@ To learn more about GPL-incompatible free software licenses where this might | |
be an issue, see: | ||
https://www.gnu.org/licenses/license-list.en.html#GPLIncompatibleLicenses | ||
|
||
Implementation Notes | ||
-------------------- | ||
On UNIX systems, spaceball callbacks are supported by talking to a 6dof device | ||
driver through the *Magellan X11 ClientMessage protocol*. This works with | ||
either the free software *spacenavd* driver, or the proprietary *3dxsrv*. | ||
Spacenavd supports all 6dof devices from the first serial ones to current | ||
models. | ||
|
||
On Windows, spaceball support relies on the 3Dconnexion driver and its old | ||
siapp API. This should work on any version of the driver from very old ones | ||
running on windows 9x and supporting serial devices, to the latest current | ||
driver for USB and bluetooth spacemice. | ||
|
||
Known Issues | ||
------------ | ||
MiniGLUT being a subset of GLUT, is missing a number of features. Some of them | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/* | ||
MiniGLUT - minimal GLUT subset without dependencies | ||
Copyright (C) 2020-2022 John Tsiombikas <[email protected]> | ||
Copyright (C) 2020-2024 John Tsiombikas <[email protected]> | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
|
@@ -2109,7 +2109,7 @@ static int handle_6dof(MSG* msg) | |
#if defined(unix) || defined(__unix__) || defined(__APPLE__) | ||
#include <sys/time.h> | ||
|
||
#ifdef MINIGLUT_USE_LIBC | ||
#ifndef MINIGLUT_NO_LIBC | ||
#define sys_gettimeofday(tv, tz) gettimeofday(tv, tz) | ||
#else | ||
static int sys_gettimeofday(struct timeval *tv, struct timezone *tz); | ||
|
@@ -2156,7 +2156,7 @@ static void panic(const char *msg) | |
} | ||
|
||
|
||
#ifdef MINIGLUT_USE_LIBC | ||
#ifndef MINIGLUT_NO_LIBC | ||
#include <stdlib.h> | ||
#ifdef _WIN32 | ||
#include <io.h> | ||
|
@@ -2174,7 +2174,7 @@ static int sys_write(int fd, const void *buf, int count) | |
return write(fd, buf, count); | ||
} | ||
|
||
#else /* !MINIGLUT_USE_LIBC */ | ||
#else /* MINIGLUT_NO_LIBC */ | ||
|
||
#ifdef __linux__ | ||
#ifdef __x86_64__ | ||
|
@@ -2247,11 +2247,11 @@ static int sys_write(int fd, const void *buf, int count) | |
return wrsz; | ||
} | ||
#endif /* _WIN32 */ | ||
#endif /* !MINIGLUT_USE_LIBC */ | ||
#endif /* MINIGLUT_NO_LIBC */ | ||
|
||
|
||
/* ----------------- primitives ------------------ */ | ||
#ifdef MINIGLUT_USE_LIBC | ||
#ifndef MINIGLUT_NO_LIBC | ||
#include <stdlib.h> | ||
#include <math.h> | ||
|
||
|
@@ -2266,7 +2266,7 @@ float mglut_atan(float x) | |
return atan(x); | ||
} | ||
|
||
#else /* !MINIGLUT_USE_LIBC */ | ||
#else /* MINIGLUT_NO_LIBC */ | ||
|
||
#ifdef __GNUC__ | ||
void mglut_sincos(float angle, float *sptr, float *cptr) | ||
|
@@ -2339,7 +2339,7 @@ float mglut_atan(float x) | |
modify [8087]; | ||
#endif /* __WATCOMC__ */ | ||
|
||
#endif /* !MINIGLUT_USE_LIBC */ | ||
#endif /* MINIGLUT_NO_LIBC */ | ||
|
||
#define PI 3.1415926536f | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/* | ||
MiniGLUT - minimal GLUT subset without dependencies | ||
Copyright (C) 2020-2022 John Tsiombikas <[email protected]> | ||
Copyright (C) 2020-2024 John Tsiombikas <[email protected]> | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
|