Skip to content

Commit

Permalink
[skip ci] basic startup for opengl & working example
Browse files Browse the repository at this point in the history
  • Loading branch information
archibate committed Feb 18, 2020
1 parent a5d6e04 commit 0a8b3c0
Show file tree
Hide file tree
Showing 10 changed files with 698 additions and 1 deletion.
4 changes: 4 additions & 0 deletions cmake/TaichiCore.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ if (TI_WITH_CUDA)
target_link_libraries(${LIBRARY_NAME} ${llvm_ptx_libs})
endif()

#target_link_libraries(${LIBRARY_NAME} /usr/lib/libGL.so GL)
target_link_libraries(${LIBRARY_NAME} /usr/lib/libGLEW.so GLEW)
target_link_libraries(${LIBRARY_NAME} /usr/lib/libglfw.so glfw)

# add_executable(runtime runtime/runtime.cpp)

# Optional dependencies
Expand Down
12 changes: 12 additions & 0 deletions examples/opengl_backend.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import taichi as ti

ti.init(arch=ti.opengl)

x = ti.var(ti.f32, shape=())
x[None] = 1

@ti.kernel
def func():
x[None] = x[None] * 2

func()
3 changes: 3 additions & 0 deletions python/taichi/lang/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
x86_64 = core.x86_64
cuda = core.cuda
metal = core.metal
opengl = core.opengl
profiler_print = lambda: core.get_current_program().profiler_print()
profiler_clear = lambda: core.get_current_program().profiler_clear()

Expand Down Expand Up @@ -178,6 +179,8 @@ def supported_archs():
archs.append(cuda)
if ti.core.with_metal():
archs.append(metal)
if ti.core.with_opengl():
archs.append(opengl)
return archs

class _ArchCheckers(object):
Expand Down
Loading

0 comments on commit 0a8b3c0

Please sign in to comment.