Uses git submodules, instead of installed libs
This commit is contained in:
parent
22ab092250
commit
05e41577fc
11 changed files with 78 additions and 22 deletions
9
.gitmodules
vendored
Normal file
9
.gitmodules
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
[submodule "contrib/CLWrapper"]
|
||||
path = contrib/CLWrapper
|
||||
url = ../libJ/CLWrapper/
|
||||
[submodule "contrib/NSAppWrapper"]
|
||||
path = contrib/NSAppWrapper
|
||||
url = ../libJ/NSAppWrapper/
|
||||
[submodule "contrib/ImageStreams"]
|
||||
path = contrib/ImageStreams
|
||||
url = ../ImageStreams/
|
|
@ -3,5 +3,8 @@ cmake_minimum_required(VERSION 2.8)
|
|||
|
||||
add_definitions(-std=c++1y)
|
||||
|
||||
add_subdirectory("contrib")
|
||||
add_subdirectory("src")
|
||||
|
||||
file(GLOB resources "resources/*")
|
||||
file(COPY ${resources} DESTINATION ${CMAKE_BINARY_DIR})
|
||||
|
|
1
contrib/CLWrapper
Submodule
1
contrib/CLWrapper
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit ee27ef82cf59dd7a02da924312a44136dce5c4bd
|
4
contrib/CMakeLists.txt
Normal file
4
contrib/CMakeLists.txt
Normal file
|
@ -0,0 +1,4 @@
|
|||
|
||||
add_subdirectory("NSAppWrapper")
|
||||
add_subdirectory("CLWrapper")
|
||||
add_subdirectory("ImageStreams")
|
1
contrib/ImageStreams
Submodule
1
contrib/ImageStreams
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit fcad14e7bf175a374c6dae12aaa059f4e325b5ca
|
1
contrib/NSAppWrapper
Submodule
1
contrib/NSAppWrapper
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 7c5ebc89b87650ae649db1b5081f729d311915c4
|
26
resources/Fractal.fsh
Normal file
26
resources/Fractal.fsh
Normal file
|
@ -0,0 +1,26 @@
|
|||
#version 330
|
||||
|
||||
uniform float rotation;
|
||||
|
||||
in vec2 pos;
|
||||
in vec2 start;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void main(){
|
||||
|
||||
vec2 z = start;
|
||||
|
||||
int i = 0;
|
||||
for (i = 0; i < 30; i++) {
|
||||
vec2 zsq = z*z;
|
||||
if(zsq.x + zsq.y > 16.0) break;
|
||||
|
||||
float t = zsq.x - zsq.y + pos.x;
|
||||
z.y = 2.0*z.x*z.y + pos.y;
|
||||
z.x = t;
|
||||
}
|
||||
|
||||
fragColor = vec4(float(i) / 30.0);
|
||||
fragColor.bg = 0.5 * sin(z) + 0.5;
|
||||
}
|
18
resources/Fractal.vsh
Normal file
18
resources/Fractal.vsh
Normal file
|
@ -0,0 +1,18 @@
|
|||
#version 330
|
||||
|
||||
uniform float rotation;
|
||||
|
||||
in vec4 position;
|
||||
in vec4 color;
|
||||
|
||||
out vec2 pos;
|
||||
out vec2 start;
|
||||
|
||||
void main(){
|
||||
pos = position.xy;
|
||||
pos.x -= 0.5;
|
||||
|
||||
start = sqrt(1.0 + 0.01 * rotation) * 0.3 * sin(vec2(0.1, 0.1337) * rotation);
|
||||
|
||||
gl_Position = position;
|
||||
}
|
8
resources/Kernel.cl
Normal file
8
resources/Kernel.cl
Normal file
|
@ -0,0 +1,8 @@
|
|||
|
||||
kernel void square(global float* input, size_t width, global float* output){
|
||||
size_t x = get_global_id(0);
|
||||
size_t y = get_global_id(1);
|
||||
float i = 2.0 * (input[x + width*y] - 0.5);
|
||||
output[x + width*y] = 0.5 + 0.5*sin((1.0 - i) * sin(i*i + 6.2*float(x)/width) + cos(1.0/i + 6.2*float(y)/width));
|
||||
}
|
||||
|
|
@ -1,17 +1,10 @@
|
|||
|
||||
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
|
||||
|
||||
file(GLOB sources "*.cpp")
|
||||
|
||||
find_library(FOUNDATION_LIBRARY Foundation)
|
||||
find_library(COCOA_LIBRARY Cocoa)
|
||||
find_library(COREGRAPHICS_LIBRARY CoreGraphics)
|
||||
find_library(QUARTZCORE_LIBRARY QuartzCore)
|
||||
find_library(OPENGL_LIBRARY OpenGL)
|
||||
find_library(OPENCL_LIBRARY OpenCL)
|
||||
find_library(LIBJNSAppWrapper JNSAppWrapper)
|
||||
find_library(LIBJOpenCL JOpenCL)
|
||||
find_library(LIBPNG png)
|
||||
|
||||
set(libs ${FOUNDATION_LIBRARY} ${COCOA_LIBRARY} ${COREGRAPHICS_LIBRARY} ${QUARTZCORE_LIBRARY} ${OPENGL_LIBRARY} ${OPENCL_LIBRARY} ${LIBJNSAppWrapper} ${LIBJOpenCL} ${LIBPNG})
|
||||
set(libs ${JCLWrapper_LIBRARIES} ${JNSAppWrapper_LIBRARIES} ${ImageStreams_LIBRARIES})
|
||||
message(STATUS "Linking against the following libraries: ${libs}")
|
||||
|
||||
foreach(source ${sources})
|
||||
get_filename_component(exec ${source} NAME_WE)
|
||||
|
|
14
src/main.cpp
14
src/main.cpp
|
@ -1,15 +1,7 @@
|
|||
//
|
||||
// main.cpp
|
||||
// XcodeOpenCL
|
||||
//
|
||||
// Created by Joshua Moerman on 28/03/14.
|
||||
//
|
||||
//
|
||||
#include <cl2.hpp>
|
||||
|
||||
#include <J/cl2.hpp>
|
||||
|
||||
#include <J/NSWrapper.hpp>
|
||||
#include "../../ImageStreams/include/png.hpp"
|
||||
#include <NSWrapper.hpp>
|
||||
#include <png.hpp>
|
||||
|
||||
#include <OpenGL/gl3.h>
|
||||
|
||||
|
|
Reference in a new issue