simple shader test

This commit is contained in:
Jeremy Penner 2013-03-26 23:56:27 -04:00
parent 35373a45bb
commit 326bd01c7a
3 changed files with 16 additions and 2 deletions

5
res/shader/blob.frag Normal file
View file

@ -0,0 +1,5 @@
void main()
{
// Setting Each Pixel To Red
gl_FragColor = vec4(1.0, 1.0, 0.0, 1.0);
}

5
res/shader/blob.vert Normal file
View file

@ -0,0 +1,5 @@
void main()
{
// Transforming The Vertex
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
}

View file

@ -39,8 +39,12 @@
man (first (gs/q :name :man))]
(gs/update-entity (assoc man :x (:mousex input) :y (:mousey input)))))
(defn render-gs [gs]
(defn render-gs [gs g]
(gs/with-gs gs
(let [shader (res/get-shader "res/shader/blob")]
(.bind shader)
(.fillRect g 0 0 100 100)
(.unbind shader))
(doseq [sprite (gs/q :type :sprite)]
(if-let [image (res/get-image (:image sprite))]
(.draw image (:x sprite) (:y sprite))))))
@ -63,7 +67,7 @@
(scr/update-screen screen screennext)))))
(defmethod slick/render-game :game [screen graphics]
(render-gs (tln/timeline-last-value (:tln screen))))
(render-gs (tln/timeline-last-value (:tln screen)) graphics))
(defmethod slick/update-game :timeshift [screen inputtln delta]
(let [input-from-tln (tln/timeline-last-value inputtln)