Skip to content

Commit

Permalink
first pass glfw implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
20k committed Oct 4, 2019
1 parent 6667fec commit 8acb077
Show file tree
Hide file tree
Showing 7 changed files with 160 additions and 65 deletions.
2 changes: 1 addition & 1 deletion deps/imgui
Submodule imgui updated 53 files
+70 −0 docs/CHANGELOG.txt
+41 −1 docs/TODO.txt
+10 −3 examples/README.txt
+1 −0 examples/example_allegro5/main.cpp
+1 −0 examples/example_apple_opengl2/main.mm
+2 −1 examples/example_emscripten/main.cpp
+24 −2 examples/example_glfw_opengl2/main.cpp
+24 −1 examples/example_glfw_opengl3/main.cpp
+20 −1 examples/example_glfw_vulkan/main.cpp
+1 −0 examples/example_glut_opengl2/main.cpp
+1 −0 examples/example_marmalade/main.cpp
+20 −1 examples/example_sdl_directx11/main.cpp
+26 −1 examples/example_sdl_opengl2/main.cpp
+26 −1 examples/example_sdl_opengl3/main.cpp
+20 −1 examples/example_sdl_vulkan/main.cpp
+22 −1 examples/example_win32_directx10/main.cpp
+42 −1 examples/example_win32_directx11/main.cpp
+20 −1 examples/example_win32_directx12/main.cpp
+36 −1 examples/example_win32_directx9/main.cpp
+76 −16 examples/imgui_examples.sln
+130 −0 examples/imgui_impl_dx10.cpp
+1 −0 examples/imgui_impl_dx10.h
+130 −0 examples/imgui_impl_dx11.cpp
+1 −0 examples/imgui_impl_dx11.h
+151 −1 examples/imgui_impl_dx12.cpp
+2 −1 examples/imgui_impl_dx12.h
+153 −0 examples/imgui_impl_dx9.cpp
+1 −0 examples/imgui_impl_dx9.h
+491 −31 examples/imgui_impl_glfw.cpp
+1 −0 examples/imgui_impl_glfw.h
+2 −0 examples/imgui_impl_metal.h
+2 −0 examples/imgui_impl_metal.mm
+39 −0 examples/imgui_impl_opengl2.cpp
+1 −0 examples/imgui_impl_opengl2.h
+100 −1 examples/imgui_impl_opengl3.cpp
+1 −0 examples/imgui_impl_opengl3.h
+1 −0 examples/imgui_impl_osx.h
+1 −0 examples/imgui_impl_osx.mm
+364 −29 examples/imgui_impl_sdl.cpp
+2 −0 examples/imgui_impl_sdl.h
+233 −7 examples/imgui_impl_vulkan.cpp
+2 −1 examples/imgui_impl_vulkan.h
+520 −9 examples/imgui_impl_win32.cpp
+6 −0 examples/imgui_impl_win32.h
+5,685 −332 imgui.cpp
+260 −29 imgui.h
+253 −7 imgui_demo.cpp
+204 −37 imgui_draw.cpp
+282 −27 imgui_internal.h
+146 −29 imgui_widgets.cpp
+174 −46 misc/freetype/imgui_freetype.cpp
+12 −2 misc/freetype/imgui_freetype.h
+4 −0 misc/natvis/imgui.natvis
2 changes: 1 addition & 1 deletion deps/ocl
Submodule ocl updated 1 files
+2 −2 ocl.cpp
20 changes: 10 additions & 10 deletions fluid.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ struct fluid_manager
int which_physics_tex = 0;
std::vector<physics_particle> cpu_physics_particles;

cl::cl_gl_interop_texture* rendered_occlusion[2];
//cl::cl_gl_interop_texture* rendered_occlusion[2];
int which_occlusion = 0;

cl::buffer* noise;
Expand Down Expand Up @@ -107,8 +107,8 @@ struct fluid_manager
w_of = buffers.fetch<cl::buffer>(ctx, nullptr);
upscaled_advected_velocity = buffers.fetch<cl::buffer>(ctx, nullptr);

rendered_occlusion[0] = buffers.fetch<cl::cl_gl_interop_texture>(ctx, nullptr);
rendered_occlusion[1] = buffers.fetch<cl::cl_gl_interop_texture>(ctx, nullptr);
//rendered_occlusion[0] = buffers.fetch<cl::cl_gl_interop_texture>(ctx, nullptr);
//rendered_occlusion[1] = buffers.fetch<cl::cl_gl_interop_texture>(ctx, nullptr);

std::vector<vec4f> zero_data;
std::vector<vec4f> dye_concentrates;
Expand Down Expand Up @@ -234,14 +234,14 @@ struct fluid_manager
physics_tex[0]->alloc_img(cqueue, zero_data, velocity_dim, CL_RG, CL_FLOAT);
physics_tex[1]->alloc_img(cqueue, zero_data, velocity_dim, CL_RG, CL_FLOAT);

cl::cl_gl_storage<sf::Texture> s1;
/*cl::cl_gl_storage<sf::Texture> s1;
cl::cl_gl_storage<sf::Texture> s2;
s1.storage->create(dye_dim.x(), dye_dim.y());
s2.storage->create(dye_dim.x(), dye_dim.y());
s2.storage->create(dye_dim.x(), dye_dim.y());*/

rendered_occlusion[0]->create_from_texture(s1.storage->getNativeHandle(), s1);
rendered_occlusion[1]->create_from_texture(s2.storage->getNativeHandle(), s2);
/*rendered_occlusion[0]->create_from_texture(s1.storage->getNativeHandle(), s1);
rendered_occlusion[1]->create_from_texture(s2.storage->getNativeHandle(), s2);*/

cl::args w_of_args;
w_of_args.push_back(noise);
Expand All @@ -250,10 +250,10 @@ struct fluid_manager
cqueue.exec("wavelet_w_of", w_of_args, velocity_dim, {16, 16});
}

cl::cl_gl_interop_texture* get_occlusion()
/*cl::cl_gl_interop_texture* get_occlusion()
{
return rendered_occlusion[which_occlusion];
}
}*/

cl::buffer* get_velocity_buf(int offset)
{
Expand Down Expand Up @@ -459,7 +459,7 @@ struct fluid_manager
cqueue.exec("falling_sand_edge_boundary_condition", generate_args, velocity_dim, {16, 16});
#endif // PARTICLES_INTERFERE_WITH_FLUID

#define GENERATE_OCCLUSION
//#define GENERATE_OCCLUSION
#ifdef GENERATE_OCCLUSION

cl::cl_gl_interop_texture* occlusion = get_occlusion();
Expand Down
6 changes: 1 addition & 5 deletions fluid_fun.cbp
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,6 @@
<Linker>
<Add option="-lmingw32" />
<Add option="-limgui" />
<Add option="-lsfml-graphics" />
<Add option="-lsfml-audio" />
<Add option="-lsfml-network" />
<Add option="-lsfml-window" />
<Add option="-lsfml-system" />
<Add option="-lfreetype" />
<Add option="-lopengl32" />
<Add option="-lws2_32" />
Expand All @@ -88,6 +83,7 @@
<Add option="-lLinearMath" />
<Add option="-lglfw3" />
<Add option="-lglew32" />
<Add option="-lsfml-system" />
<Add directory="deps/bullet" />
</Linker>
<Unit filename="Shaders/cull.fglsl" />
Expand Down
Loading

0 comments on commit 8acb077

Please sign in to comment.