Permalink
Browse files

* .gitignore: initial commit.

  • Loading branch information...
0 parents commit f34a52a5c4f21728338d246d56f1016fdb4ee10f @swannodette committed Feb 18, 2010
Showing with 114 additions and 0 deletions.
  1. +5 −0 .gitignore
  2. +15 −0 README
  3. +8 −0 project.clj
  4. +10 −0 readme.textile
  5. +70 −0 src/clj_nehe/tutorial1.clj
  6. +6 −0 test/clj_nehe/core_test.clj
@@ -0,0 +1,5 @@
+pom.xml
+*jar
+lib
+classes
+native
15 README
@@ -0,0 +1,15 @@
+# clj-nehe
+
+FIXME: write description
+
+## Usage
+
+FIXME: write
+
+## Installation
+
+FIXME: write
+
+## License
+
+FIXME: write
@@ -0,0 +1,8 @@
+(defproject clj-nehe "1.0.0-SNAPSHOT"
+ :description "FIXME: write"
+ :dependencies [[org.clojure/clojure "1.1.0"]
+ [org.clojure/clojure-contrib "1.1.0"]
+ [penumbra "0.5.0-SNAPSHOT"]]
+ :native-dependencies [[lwjgl "2.2.2"]]
+ :dev-dependencies [[native-deps "1.0.0-SNAPSHOT"]
+ [leiningen/lein-swank "1.1.0"]])
@@ -0,0 +1,10 @@
+h1. Trouble Shooting
+
+The signatures of your methods are *really* important.
+
+(defn reshape [[x y width height] state]
+ ...)
+
+It also important that if you use app/start that you pass in a map for the state.
+
+(app/start callback state)
@@ -0,0 +1,70 @@
+(ns clj-nehe.tutorial1
+ (:use [penumbra opengl geometry]
+ [penumbra.opengl.core :only [gl-import]])
+ (:require [penumbra.app :as app]
+ [penumbra.text :as text]))
+
+;; -----------------------------------------------------------------------------
+;; Vars
+
+(def *width* 640.0)
+
+(def *height* 480.0)
+
+(def *tri* [[0.0 1.0 0.0]
+ [-1.0 -1.0 0.0]
+ [1.0 -1.0 0.0]])
+
+(def *sqr* [[-1.0 1.0 0.0]
+ [1.0 1.0 0.0]
+ [1.0 -1.0 0.0]
+ [-1.0 -1.0 0.0]])
+
+;; -----------------------------------------------------------------------------
+;; Import
+
+(gl-import glClearDepth clear-depth)
+
+;; -----------------------------------------------------------------------------
+;; Fns
+
+(defn init [state]
+ (println "init")
+ (app/title! "Nehe Tutorial 2")
+ (app/vsync! false)
+ (app/display-mode! *width* *height*)
+ (shade-model :smooth)
+ (clear-color 0.0 0.0 0.0 0.5)
+ (clear-depth 1.0)
+ (enable :depth-test)
+ (depth-test :lequal)
+ (hint :perspective-correction-hint :nicest)
+ state)
+
+(defn reshape [[x y width height] state]
+ (viewport 0 0 *width* *height*)
+ (frustum-view 45.0 (/ *width* *height*) 0.1 100.0)
+ (gl-load-identity-matrix))
+
+(defn display [[delta time] state]
+ (clear)
+ (gl-load-identity-matrix)
+ (translate -1.5 0.0 -6.0)
+ (draw-triangles
+ (doall (map #(apply vertex %) *tri*)))
+ (translate 3.0 0.0 0.0)
+ (draw-quads
+ (doall (map #(apply vertex %) *sqr*)))
+ (app/repaint!))
+
+(defn display-proxy [& args]
+ (apply display args))
+
+(def options {:reshape reshape
+ :display display-proxy
+ :init init})
+
+(defn start []
+ (app/start options {}))
+
+(start)
@@ -0,0 +1,6 @@
+(ns clj-nehe.core-test
+ (:use [clj-nehe.core] :reload-all)
+ (:use [clojure.test]))
+
+(deftest replace-me ;; FIXME: write
+ (is false))

0 comments on commit f34a52a

Please sign in to comment.