(perspective-texture-data-3d-example game)

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-data-3d-example [game] (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 data/cube, :type (gl game FLOAT), :size 3}, 'a_texcoord {:data data/cube-texcoords, :type (gl game FLOAT), :size 2, :normalize true}}, :uniforms {'u_texture {:data [128 64 128 0 192 0], :opts {:mip-level 0, :internal-fmt (gl game R8), :width 3, :height 2, :border 0, :src-fmt (gl game RED), :src-type (gl game UNSIGNED_BYTE)}, :alignment 1, :params {(gl game TEXTURE_WRAP_S) (gl game CLAMP_TO_EDGE), (gl game TEXTURE_WRAP_T) (gl game CLAMP_TO_EDGE), (gl game TEXTURE_MIN_FILTER) (gl game NEAREST), (gl game TEXTURE_MAG_FILTER) (gl game NEAREST)}}}, :clear {:color [1 1 1 1], :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)))