(perspective-texture-3d-example game {:keys [data width height]})

Example

(play-cljc.gl.core/render game (-> entity (assoc :viewport {:x 0, :y 0, :width game-width, :height game-height}) (play-cljc.transforms/project (play-cljc.math/deg->rad 60) (/ game-width game-height) 1 2000) (play-cljc.transforms/invert camera) (play-cljc.transforms/rotate rx :x) (play-cljc.transforms/rotate ry :y)))

Source

(defn perspective-texture-3d-example [game {:keys [data width height]}] (gl game enable (gl game CULL_FACE)) (gl game enable (gl game DEPTH_TEST)) (let [entity (->> {:vertex data/texture-vertex-shader, :fragment data/texture-fragment-shader, :attributes {'a_position {:data (transform-f-data data/f-3d), :type (gl game FLOAT), :size 3}, 'a_texcoord {:data data/f-texcoords, :type (gl game FLOAT), :size 2, :normalize true}}, :uniforms {'u_texture {:data data, :opts {:mip-level 0, :internal-fmt (gl game RGBA), :width width, :height height, :border 0, :src-fmt (gl game RGBA), :src-type (gl game UNSIGNED_BYTE)}, :mipmap true}}, :clear {:color [0 0 0 0], :depth 1}} e/map->ThreeDEntity (c/compile game)) state {:rx (m/deg->rad 190), :ry (m/deg->rad 40)}] (assoc game :entity entity :state state)))