This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; redefine draw function then update display automatically | |
(extend gl.processing) | |
(use gl.processing.interactive) | |
(setup-with-other-thread | |
(lambda () | |
(window 200 200 "animation" 0 100) | |
(rect-mode! 'center) | |
(update-timer 100))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(use gl.processing) | |
(use gl.processing.interactive) | |
;; animation | |
(define *angle* 0) | |
(define draw | |
(draw$ (lambda () | |
(translate 150 150) | |
(rotate *angle* 0 0 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "glut.h" | |
#define _USE_MATH_DEFINES | |
#include < math.h > | |
double a=0;//回転角度 | |
void drawsquare(double w){ | |
glBegin(GL_POLYGON); | |
glVertex2d(-w, -w); | |
glVertex2d( w, -w); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; Drawing \ Processing.org http://processing.org/learning/drawing/ | |
;;; http://processing.org/learning/drawing/imgs/1.11.jpg | |
(use gl.processing) | |
(define draw | |
(draw$ (^ () | |
(rect 100 100 20 100) | |
(ellipse 100 70 60 60) | |
(ellipse 81 70 16 32) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(use gl.processing) | |
(use gl.processing.interactive) ;;using timer$ | |
;;; utlity | |
(define *mouse-button* #f) ;;left,right,middle | |
(define *mouse-pressed?* #f) | |
(define *mouse-clicked?* #f) | |
(define *mouse-x* -inf.0) | |
(define *mouse-y* -inf.0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Getting Started \ Processing.org http://processing.org/learning/gettingstarted/ | |
;; Example 2-2: Make Circle | |
(use gl.processing) | |
;;; utlity | |
;; these function are not implemented yet. | |
;;mouse-clicked <fun> | |
;;mouse-dragged <fun> | |
;;mouse-moved <fun> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(use gl.processing) | |
(define draw | |
(draw-once$ (^ () | |
(fill 255 255 255) | |
(let1 s "The quick brown 狐 jumped over the lazy 犬." | |
(text s 15 20 70 70)) | |
(let1 s "こんにちは。こんにちは。日本語でも適切に折り返してくれますか?" | |
(text s 15 120 70 70))) | |
:save "foo.png")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(gl-matrix-mode GL_TEXTURE) | |
(gl-load-identity) | |
(gl-scale 1.0 -1.0 1.0) | |
(gl-matrix-mode GL_MODELVIEW) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; ;; blending | |
;; GL_ZERO (0,0,0,0) | |
;; GL_ONE (1,1,1,1) | |
;; GL_SRC_COLOR (Rs/kR ,Gs/kG,Bs/kB,As/kA) | |
;; GL_ONE_MINUS_SRC_COLOR (1,1,1,1)-(Rs/kR,Gs/kG,Bs/kB,As/kA) | |
;; GL_DST_COLOR (Rd/kR,Gd/kG,Bd/kB,Ad/kA) | |
;; GL_ONE_MINUS_DST_COLOR (1,1,1,1)-(Rd/kR,Gd/kG,Bd/kB,Ad/kA) | |
;; GL_SRC_ALPHA (As/kA,As/kA,As/kA,As/kA) | |
;; GL_ONE_MINUS_SRC_ALPHA (1,1,1,1)-(As/kA,As/kA,As/kA,As/kA) | |
;; GL_DST_ALPHA (Ad/kA,Ad/kA,Ad/kA,Ad/kA) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <math.h> | |
float pi = atan(1.0)*4; | |
float noise(int x, int y){ | |
int n = x + y * 57; | |
n = (n<<13) ^ n; | |
return ( 1.0 - ( (n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0); | |
} |