Skip to content
This repository
Browse code

some fixes to support my new laptop config

  • Loading branch information...
commit 1d77321b8360b0d3a11409727e999469d2e5b776 1 parent 6cb7d97
Zach Tellman authored
2  src/penumbra/app.clj
@@ -182,7 +182,7 @@
182 182
         (filter #(imports (:name %)) sigs))))))
183 183
 
184 184
 (auto-import penumbra.app.window/Window
185  
-             title! size fullscreen! vsync! display-mode!)
  185
+             title! size fullscreen! vsync! display-mode! display-modes)
186 186
 
187 187
 (auto-import penumbra.app.controller/Controller
188 188
              stop! pause!)
6  src/penumbra/glsl/core.clj
@@ -194,9 +194,9 @@
194 194
 (defmethod transformer 'nth [x]
195 195
   (concat
196 196
    (take (-> x count dec) x)
197  
-   (if (-> x last number?)
  197
+   (if (or (-> x last number?) (-> x last typeof (= :int)))
198 198
      (list (int (last x)))
199  
-     (list (list 'int (last x))))))
  199
+     (list (last x)))))
200 200
 
201 201
 (defmethod transformer 'lighting [x]
202 202
   (list* 'lighting (list 'int (second x)) (nnext x)))
@@ -255,4 +255,4 @@
255 255
         (map #(list 'declare %) decl))
256 256
        (list
257 257
         'defn 'void 'main []
258  
-        (list 'do x))))))
  258
+        (list 'do x))))))
12  src/penumbra/glsl/effects.clj
@@ -12,17 +12,17 @@
12 12
   '((defn float4 lighting
13 13
       [(in int -i)
14 14
        (in float3 -normal)]
15  
-      (let [n-dot-vp (max 0 (dot -normal (-> :light-source (nth -i) .position float3 normalize)))
16  
-            n-dot-hv (max 0 (dot -normal (-> :light-source (nth -i) .halfVector float3 normalize)))]
  15
+      (let [n-dot-vp (max 0 (dot -normal (-> :light-source (nth 0) .position float3 normalize)))
  16
+            n-dot-hv (max 0 (dot -normal (-> :light-source (nth 0) .halfVector float3 normalize)))]
17 17
         (let [pf (float (if (= n-dot-vp 0)
18 18
                           0
19 19
                           (pow n-dot-hv (-> :front-material .shininess))))
20  
-              ambient (float4 (-> :light-source (nth -i) .ambient))
21  
-              diffuse (float4 (-> :light-source (nth -i) .diffuse (* n-dot-vp)))
22  
-              specular (float4 (-> :light-source (nth -i) .specular (* pf)))]
  20
+              ambient (float4 (-> :light-source (nth 0) .ambient))
  21
+              diffuse (float4 (-> :light-source (nth 0) .diffuse (* n-dot-vp)))
  22
+              specular (float4 (-> :light-source (nth 0) .specular (* pf)))]
23 23
           (return
24 24
            (+
25 25
             (-> :front-light-model-product .sceneColor)
26 26
             (-> :front-material .ambient (* ambient))
27 27
             (-> :front-material .specular (* specular))
28  
-            (-> :front-material .diffuse (* diffuse)))))))))
  28
+            (-> :front-material .diffuse (* diffuse)))))))))
2  src/penumbra/glsl/operators.clj
@@ -470,4 +470,4 @@
470 470
           (with-program (:program info)
471 471
             (run-renderer
472 472
              (assoc info :attributes (:attributes programs))
473  
-             f)))))))
  473
+             f)))))))
28  src/penumbra/opengl/frame_buffer.clj
@@ -16,11 +16,11 @@
16 16
 
17 17
 ;;Render Buffers
18 18
 
19  
-(gl-import- glGenRenderbuffers gl-gen-render-buffers)
20  
-(gl-import- glBindRenderbuffer gl-bind-render-buffer)
21  
-(gl-import- glRenderbufferStorage gl-render-buffer-storage)
22  
-(gl-import- glFramebufferRenderbuffer gl-frame-buffer-render-buffer)
23  
-(gl-import- glDeleteRenderbuffers gl-delete-render-buffers)
  19
+(gl-import- glGenRenderbuffersEXT gl-gen-render-buffers)
  20
+(gl-import- glBindRenderbufferEXT gl-bind-render-buffer)
  21
+(gl-import- glRenderbufferStorageEXT gl-render-buffer-storage)
  22
+(gl-import- glFramebufferRenderbufferEXT gl-frame-buffer-render-buffer)
  23
+(gl-import- glDeleteRenderbuffersEXT gl-delete-render-buffers)
24 24
 
25 25
 (defn gen-render-buffer
26 26
   "Creates a render buffer."
@@ -58,14 +58,14 @@
58 58
 
59 59
 ;;Frame Buffers
60 60
 
61  
-(gl-import- glGenFramebuffers gl-gen-frame-buffers)
62  
-(gl-import- glBindFramebuffer gl-bind-frame-buffer)
63  
-(gl-import- glCheckFramebufferStatus gl-check-frame-buffer-status)
64  
-(gl-import- glDeleteFramebuffers gl-delete-frame-buffers)
65  
-(gl-import- glFramebufferTexture gl-frame-buffer-texture)
66  
-(gl-import- glFramebufferTexture2D gl-frame-buffer-texture-2d)
67  
-(gl-import- glFramebufferTexture3D gl-frame-buffer-texture-3d)
68  
-(gl-import- glFramebufferTextureLayer gl-frame-buffer-texture-layer)
  61
+(gl-import- glGenFramebuffersEXT gl-gen-frame-buffers)
  62
+(gl-import- glBindFramebufferEXT gl-bind-frame-buffer)
  63
+(gl-import- glCheckFramebufferStatusEXT gl-check-frame-buffer-status)
  64
+(gl-import- glDeleteFramebuffersEXT gl-delete-frame-buffers)
  65
+(gl-import- glFramebufferTextureEXT gl-frame-buffer-texture)
  66
+(gl-import- glFramebufferTexture2DEXT gl-frame-buffer-texture-2d)
  67
+(gl-import- glFramebufferTexture3DEXT gl-frame-buffer-texture-3d)
  68
+(gl-import- glFramebufferTextureLayerEXT gl-frame-buffer-texture-layer)
69 69
 (gl-import- glDrawBuffers gl-draw-buffers)
70 70
 (gl-import- glDrawBuffer draw-buffer)
71 71
 (gl-import- glReadBuffer gl-read-buffer)
@@ -178,4 +178,4 @@
178 178
     (try
179 179
      (f)
180 180
      (finally
181  
-      (bind-frame-buffer 0)))))
  181
+      (bind-frame-buffer 0)))))
1  src/penumbra/text.clj
@@ -24,6 +24,7 @@
24 24
   (if-let [font (@*font-cache* (list* name modifiers))]
25 25
     font
26 26
     (let [hash (apply hash-map modifiers)
  27
+	  hash (update-in hash [:size] float)
27 28
           hash (assoc hash :family name)
28 29
           hash (zipmap (map text-attribute (keys hash)) (vals hash))
29 30
           font (TrueTypeFont. (Font. hash) true)]
15  test/example/opengl/marble.clj
@@ -20,12 +20,7 @@
20 20
   (frustum-view 60. (/ w (double h)) 0.1 10.)
21 21
   (load-identity)
22 22
   (translate 0 0 -3)
23  
-  (light 0
24  
-    :position [1 1 1 0])
25  
-  (material :front-and-back
26  
-    :ambient-and-diffuse [1 1 1 1]
27  
-    :specular            [0.5 0.4 0.4 1]
28  
-    :shininess           64)
  23
+  
29 24
   state)
30 25
 
31 26
 (defn reset-random-texture
@@ -62,7 +57,7 @@
62 57
                   (*= pos (float3 2)))
63 58
                 (let [marble (-> position .x (+ noise) (* 2) sin abs)
64 59
                       mixed (mix [0.2 0.15 0.1 1] [0.8 0.7 0.7 1] (pow marble 0.75))]
65  
-                  (* mixed (lighting 0 normal))))) 
  60
+                  (* mixed (lighting 0 normal)))))
66 61
   
67 62
   (app/title! "Marble")
68 63
   (enable :depth-test)
@@ -85,6 +80,12 @@
85 80
     state))
86 81
 
87 82
 (defn display [[delta time] state]
  83
+  (light 0
  84
+    :position [1 1 1 0])
  85
+  (material :front-and-back
  86
+    :ambient-and-diffuse [1 1 1 1]
  87
+    :specular            [0.5 0.4 0.4 1]
  88
+    :shininess           64)
88 89
   (rotate (:rot-x state) 1 0 0)
89 90
   (rotate (:rot-y state) 0 1 0)
90 91
   (color 1 0 0)

0 notes on commit 1d77321

Please sign in to comment.
Something went wrong with that request. Please try again.