Skip to content

Commit

Permalink
Fixed X11 multi-monitor issues on Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
ProjectPhysX committed Jan 21, 2024
1 parent e974c92 commit 01e1af5
Show file tree
Hide file tree
Showing 14 changed files with 5,083 additions and 15 deletions.
6 changes: 3 additions & 3 deletions DOCUMENTATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,9 @@ git clone https://github.com/ProjectPhysX/FluidX3D.git
while(lbm.get_t()<lbm_T) { // main simulation loop
if(lbm.graphics.next_frame(lbm_T, 25.0f)) { // render enough frames for 25 seconds of 60fps video
lbm.graphics.set_camera_free(float3(2.5f*(float)Nx, 0.0f*(float)Ny, 0.0f*(float)Nz), 0.0f, 0.0f, 50.0f); // set camera to position 1
lbm.graphics.write_frame(get_exe_path()+"export/camera_angle_1/"); // export image from camera position 1
lbm.graphics.write_frame(get_exe_path()+"export/camera_1/"); // export image from camera position 1
lbm.graphics.set_camera_centered(-40.0f, 20.0f, 78.0f, 1.25f); // set camera to position 2
lbm.graphics.write_frame(get_exe_path()+"export/camera_angle_2/"); // export image from camera position 2
lbm.graphics.write_frame(get_exe_path()+"export/camera_2/"); // export image from camera position 2
}
lbm.run(1u); // run 1 LBM time step
}
Expand All @@ -221,7 +221,7 @@ git clone https://github.com/ProjectPhysX/FluidX3D.git
- Exported frames will automatically be assigned the current simulation time step in their name, in the format `bin/export/image-123456789.png`.
- To convert the rendered `.png` images to video, use [FFmpeg](https://ffmpeg.org/):
```bash
ffmpeg -framerate 60 -pattern_type glob -i "./bin/export/*/image-*.png" -c:v libx264 -pix_fmt yuv420p -b:v 24M "video.mp4"
ffmpeg -framerate 60 -pattern_type glob -i "export/*/image-*.png" -c:v libx264 -pix_fmt yuv420p -b:v 24M "video.mp4"
```
### Data Export
Expand Down
2 changes: 1 addition & 1 deletion make.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ if command -v make &>/dev/null; then # if make is available, compile FluidX3D wi
else # else (make is not installed), compile FluidX3D with a single CPU core
mkdir -p bin # create directory for executable
rm -rf temp bin/FluidX3D # prevent execution of old executable if compiling fails
if [ $TARGET == Linux-X11 ]; then g++ src/*.cpp -o bin/FluidX3D -std=c++17 -pthread -I./src/OpenCL/include -L./src/OpenCL/lib -lOpenCL -I./src/X11/include -L./src/X11/lib -lX11; fi
if [ $TARGET == Linux-X11 ]; then g++ src/*.cpp -o bin/FluidX3D -std=c++17 -pthread -I./src/OpenCL/include -L./src/OpenCL/lib -lOpenCL -I./src/X11/include -L./src/X11/lib -lX11 -lXrandr; fi
if [ $TARGET == Linux ]; then g++ src/*.cpp -o bin/FluidX3D -std=c++17 -pthread -I./src/OpenCL/include -L./src/OpenCL/lib -lOpenCL; fi
if [ $TARGET == macOS ]; then g++ src/*.cpp -o bin/FluidX3D -std=c++17 -pthread -I./src/OpenCL/include -framework OpenCL; fi
if [ $TARGET == Android ]; then g++ src/*.cpp -o bin/FluidX3D -std=c++17 -pthread -I./src/OpenCL/include -L/system/vendor/lib64 -lOpenCL; fi
Expand Down
6 changes: 5 additions & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@ MAKEFLAGS = -j$(nproc)
CC = g++
CFLAGS = -std=c++17 -pthread

.PHONY: no-target
no-target:
@echo Please select one of these targets: make Linux-X11, make Linux, make macOS, make Android

Linux-X11 Linux: LDFLAGS_OPENCL = -I./src/OpenCL/include -L./src/OpenCL/lib -lOpenCL
macOS: LDFLAGS_OPENCL = -I./src/OpenCL/include -framework OpenCL
Android: LDFLAGS_OPENCL = -I./src/OpenCL/include -L/system/vendor/lib64 -lOpenCL

Linux-X11: LDFLAGS_X11 = -I./src/X11/include -L./src/X11/lib -lX11
Linux-X11: LDFLAGS_X11 = -I./src/X11/include -L./src/X11/lib -lX11 -lXrandr
Linux macOS Android: LDFLAGS_X11 =

Linux-X11 Linux macOS Android: bin/FluidX3D
Expand Down
108 changes: 108 additions & 0 deletions src/X11/include/X11/Xdefs.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
/***********************************************************
Copyright (c) 1999 The XFree86 Project Inc.
All Rights Reserved.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The XFree86 Project
Inc. shall not be used in advertising or otherwise to promote the
sale, use or other dealings in this Software without prior written
authorization from The XFree86 Project Inc..
*/

/**
** Types definitions shared between server and clients
**/

#ifndef _XDEFS_H
#define _XDEFS_H

#ifdef _XSERVER64
#include <X11/Xmd.h>
#endif

#ifndef _XTYPEDEF_ATOM
# define _XTYPEDEF_ATOM
# ifndef _XSERVER64
typedef unsigned long Atom;
# else
typedef CARD32 Atom;
# endif
#endif

#ifndef Bool
# ifndef _XTYPEDEF_BOOL
# define _XTYPEDEF_BOOL
typedef int Bool;
# endif
#endif

#ifndef _XTYPEDEF_POINTER
# define _XTYPEDEF_POINTER
typedef void *pointer;
#endif

#ifndef _XTYPEDEF_CLIENTPTR
typedef struct _Client *ClientPtr;
# define _XTYPEDEF_CLIENTPTR
#endif

#ifndef _XTYPEDEF_XID
# define _XTYPEDEF_XID
# ifndef _XSERVER64
typedef unsigned long XID;
# else
typedef CARD32 XID;
# endif
#endif

#ifndef _XTYPEDEF_MASK
# define _XTYPEDEF_MASK
# ifndef _XSERVER64
typedef unsigned long Mask;
# else
typedef CARD32 Mask;
# endif
#endif

#ifndef _XTYPEDEF_FONTPTR
# define _XTYPEDEF_FONTPTR
typedef struct _Font *FontPtr; /* also in fonts/include/font.h */
#endif

#ifndef _XTYPEDEF_FONT
# define _XTYPEDEF_FONT
typedef XID Font;
#endif

#ifndef _XTYPEDEF_FSID
# ifndef _XSERVER64
typedef unsigned long FSID;
# else
typedef CARD32 FSID;
# endif
#endif

typedef FSID AccContext;

/* OS independent time value
XXX Should probably go in Xos.h */
typedef struct timeval **OSTimePtr;


typedef void (* BlockHandlerProcPtr)(void * /* blockData */,
OSTimePtr /* pTimeout */,
void * /* pReadmask */);

#endif
Loading

0 comments on commit 01e1af5

Please sign in to comment.