summaryrefslogtreecommitdiff
path: root/glflag/test.bmx
blob: 7fadef6f44154da0d5cc40c8dcf39e0905365ce4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
' $Id$

Import noddybox.glflag

Const SCRW=800
Const SCRH=600

bglCreateContext(SCRW,SCRH,32,0,BGL_BACKBUFFER|BGL_DEPTHBUFFER|BGL_FULLSCREEN)
glewInit()

tid1=bglTexFromPixmap(LoadPixmap("earth.png"))
tid2=bglTexFromPixmap(LoadPixmap("tile.png"))

If tid1=0 Or tid2=0
	RuntimeError "Failed to open textures"
EndIf

glClearColor(0.0, 0.0, 0.0, 1.0)
glMatrixMode(GL_PROJECTION)
glLoadIdentity()
gluPerspective(45.0, SCRW/SCRH, 10, 10000)

glEnable(GL_DEPTH_TEST)
glEnable(GL_TEXTURE_2D)
glEnable(GL_CULL_FACE)
glDisable(GL_LIGHTING)

glMatrixMode(GL_MODELVIEW)

cells=100
size=10

f1:TGLFlag=TGLFlag.Create(tid1,cells,cells,size,False,-400)
f2:TGLFlag=TGLFlag.Create(tid2,cells,cells,size,True,-400)

f1.SetMove(300)
f2.SetMove(300)
'f.xrot=-60

For x=0 Until cells
	For y=0 Until cells
		dx=cells/2-x
		dy=cells/2-y
		
		f1.Nudge(x,y,((dx*dx)+(dy*dy))*10,50)
		f2.Nudge(x,y,((dx*dx)+(dy*dy))*10+1800,50)
		c:+100
	Next
Next

While Not KeyDown(KEY_ESCAPE)
	glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT)
	glLoadIdentity()
	f1.Render()
	f2.Render()
	'f.yrot:+0.1
	bglSwapBuffers
	FlushMem
Wend