Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

some fixes to support my new laptop config

  • Loading branch information...
commit 1d77321b8360b0d3a11409727e999469d2e5b776 1 parent 6cb7d97
@ztellman authored
View
2  src/penumbra/app.clj
@@ -182,7 +182,7 @@
(filter #(imports (:name %)) sigs))))))
(auto-import penumbra.app.window/Window
- title! size fullscreen! vsync! display-mode!)
+ title! size fullscreen! vsync! display-mode! display-modes)
(auto-import penumbra.app.controller/Controller
stop! pause!)
View
6 src/penumbra/glsl/core.clj
@@ -194,9 +194,9 @@
(defmethod transformer 'nth [x]
(concat
(take (-> x count dec) x)
- (if (-> x last number?)
+ (if (or (-> x last number?) (-> x last typeof (= :int)))
(list (int (last x)))
- (list (list 'int (last x))))))
+ (list (last x)))))
(defmethod transformer 'lighting [x]
(list* 'lighting (list 'int (second x)) (nnext x)))
@@ -255,4 +255,4 @@
(map #(list 'declare %) decl))
(list
'defn 'void 'main []
- (list 'do x))))))
+ (list 'do x))))))
View
12 src/penumbra/glsl/effects.clj
@@ -12,17 +12,17 @@
'((defn float4 lighting
[(in int -i)
(in float3 -normal)]
- (let [n-dot-vp (max 0 (dot -normal (-> :light-source (nth -i) .position float3 normalize)))
- n-dot-hv (max 0 (dot -normal (-> :light-source (nth -i) .halfVector float3 normalize)))]
+ (let [n-dot-vp (max 0 (dot -normal (-> :light-source (nth 0) .position float3 normalize)))
+ n-dot-hv (max 0 (dot -normal (-> :light-source (nth 0) .halfVector float3 normalize)))]
(let [pf (float (if (= n-dot-vp 0)
0
(pow n-dot-hv (-> :front-material .shininess))))
- ambient (float4 (-> :light-source (nth -i) .ambient))
- diffuse (float4 (-> :light-source (nth -i) .diffuse (* n-dot-vp)))
- specular (float4 (-> :light-source (nth -i) .specular (* pf)))]
+ ambient (float4 (-> :light-source (nth 0) .ambient))
+ diffuse (float4 (-> :light-source (nth 0) .diffuse (* n-dot-vp)))
+ specular (float4 (-> :light-source (nth 0) .specular (* pf)))]
(return
(+
(-> :front-light-model-product .sceneColor)
(-> :front-material .ambient (* ambient))
(-> :front-material .specular (* specular))
- (-> :front-material .diffuse (* diffuse)))))))))
+ (-> :front-material .diffuse (* diffuse)))))))))
View
2  src/penumbra/glsl/operators.clj
@@ -470,4 +470,4 @@
(with-program (:program info)
(run-renderer
(assoc info :attributes (:attributes programs))
- f)))))))
+ f)))))))
View
28 src/penumbra/opengl/frame_buffer.clj
@@ -16,11 +16,11 @@
;;Render Buffers
-(gl-import- glGenRenderbuffers gl-gen-render-buffers)
-(gl-import- glBindRenderbuffer gl-bind-render-buffer)
-(gl-import- glRenderbufferStorage gl-render-buffer-storage)
-(gl-import- glFramebufferRenderbuffer gl-frame-buffer-render-buffer)
-(gl-import- glDeleteRenderbuffers gl-delete-render-buffers)
+(gl-import- glGenRenderbuffersEXT gl-gen-render-buffers)
+(gl-import- glBindRenderbufferEXT gl-bind-render-buffer)
+(gl-import- glRenderbufferStorageEXT gl-render-buffer-storage)
+(gl-import- glFramebufferRenderbufferEXT gl-frame-buffer-render-buffer)
+(gl-import- glDeleteRenderbuffersEXT gl-delete-render-buffers)
(defn gen-render-buffer
"Creates a render buffer."
@@ -58,14 +58,14 @@
;;Frame Buffers
-(gl-import- glGenFramebuffers gl-gen-frame-buffers)
-(gl-import- glBindFramebuffer gl-bind-frame-buffer)
-(gl-import- glCheckFramebufferStatus gl-check-frame-buffer-status)
-(gl-import- glDeleteFramebuffers gl-delete-frame-buffers)
-(gl-import- glFramebufferTexture gl-frame-buffer-texture)
-(gl-import- glFramebufferTexture2D gl-frame-buffer-texture-2d)
-(gl-import- glFramebufferTexture3D gl-frame-buffer-texture-3d)
-(gl-import- glFramebufferTextureLayer gl-frame-buffer-texture-layer)
+(gl-import- glGenFramebuffersEXT gl-gen-frame-buffers)
+(gl-import- glBindFramebufferEXT gl-bind-frame-buffer)
+(gl-import- glCheckFramebufferStatusEXT gl-check-frame-buffer-status)
+(gl-import- glDeleteFramebuffersEXT gl-delete-frame-buffers)
+(gl-import- glFramebufferTextureEXT gl-frame-buffer-texture)
+(gl-import- glFramebufferTexture2DEXT gl-frame-buffer-texture-2d)
+(gl-import- glFramebufferTexture3DEXT gl-frame-buffer-texture-3d)
+(gl-import- glFramebufferTextureLayerEXT gl-frame-buffer-texture-layer)
(gl-import- glDrawBuffers gl-draw-buffers)
(gl-import- glDrawBuffer draw-buffer)
(gl-import- glReadBuffer gl-read-buffer)
@@ -178,4 +178,4 @@
(try
(f)
(finally
- (bind-frame-buffer 0)))))
+ (bind-frame-buffer 0)))))
View
1  src/penumbra/text.clj
@@ -24,6 +24,7 @@
(if-let [font (@*font-cache* (list* name modifiers))]
font
(let [hash (apply hash-map modifiers)
+ hash (update-in hash [:size] float)
hash (assoc hash :family name)
hash (zipmap (map text-attribute (keys hash)) (vals hash))
font (TrueTypeFont. (Font. hash) true)]
View
15 test/example/opengl/marble.clj
@@ -20,12 +20,7 @@
(frustum-view 60. (/ w (double h)) 0.1 10.)
(load-identity)
(translate 0 0 -3)
- (light 0
- :position [1 1 1 0])
- (material :front-and-back
- :ambient-and-diffuse [1 1 1 1]
- :specular [0.5 0.4 0.4 1]
- :shininess 64)
+
state)
(defn reset-random-texture
@@ -62,7 +57,7 @@
(*= pos (float3 2)))
(let [marble (-> position .x (+ noise) (* 2) sin abs)
mixed (mix [0.2 0.15 0.1 1] [0.8 0.7 0.7 1] (pow marble 0.75))]
- (* mixed (lighting 0 normal)))))
+ (* mixed (lighting 0 normal)))))
(app/title! "Marble")
(enable :depth-test)
@@ -85,6 +80,12 @@
state))
(defn display [[delta time] state]
+ (light 0
+ :position [1 1 1 0])
+ (material :front-and-back
+ :ambient-and-diffuse [1 1 1 1]
+ :specular [0.5 0.4 0.4 1]
+ :shininess 64)
(rotate (:rot-x state) 1 0 0)
(rotate (:rot-y state) 0 1 0)
(color 1 0 0)
Please sign in to comment.
Something went wrong with that request. Please try again.