Subversion Repositories Kolibri OS

Rev

Rev 8069 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
5218 IgorA 1
use32
8069 IgorA 2
	org 0
5218 IgorA 3
	db 'MENUET01'
8069 IgorA 4
	dd 1,start,i_end,mem,stacktop,0,cur_dir_path
5218 IgorA 5
 
8069 IgorA 6
include '../../../../../proc32.inc'
7
include '../../../../../macros.inc'
8
include '../../../../../KOSfuncs.inc'
8408 IgorA 9
include '../../../../../load_lib.mac'
8069 IgorA 10
include '../../../../../dll.inc'
5218 IgorA 11
include '../opengl_const.inc'
12
 
13
@use_library
14
 
15
align 4
16
start:
8408 IgorA 17
	load_library name_tgl, library_path, system_path, import_tinygl
8069 IgorA 18
	cmp eax,SF_TERMINATE_PROCESS
5218 IgorA 19
	jz button.exit
20
 
8069 IgorA 21
	mcall SF_SET_EVENTS_MASK,0x27
5218 IgorA 22
 
23
stdcall [kosglMakeCurrent], 10,10,300,225,ctx1
24
stdcall [glEnable], GL_DEPTH_TEST
8408 IgorA 25
call [gluNewQuadric]
5218 IgorA 26
mov [qObj],eax
27
 
28
stdcall [glClearColor], 0.5,0.5,0.5,0.0
29
 
30
call draw_3d
31
 
32
align 4
33
red_win:
34
	call draw_window
35
 
8069 IgorA 36
align 16
5218 IgorA 37
still:
8069 IgorA 38
	mcall SF_WAIT_EVENT
5218 IgorA 39
	cmp al,1
40
	jz red_win
41
	cmp al,2
42
	jz key
43
	cmp al,3
44
	jz button
45
	jmp still
46
 
47
align 4
48
draw_window:
49
	pushad
8069 IgorA 50
	mcall SF_REDRAW,SSF_BEGIN_DRAW
5218 IgorA 51
 
52
	mov edx,0x33ffffff ;0x73ffffff
8069 IgorA 53
	mcall SF_CREATE_WINDOW,(50 shl 16)+330,(30 shl 16)+275,,,caption
54
	call [kosglSwapBuffers]
5218 IgorA 55
 
8069 IgorA 56
	mcall SF_REDRAW,SSF_END_DRAW
5218 IgorA 57
	popad
58
	ret
59
 
60
align 4
61
key:
8069 IgorA 62
	mcall SF_GET_KEY
5218 IgorA 63
 
64
	cmp ah,27 ;Esc
65
	je button.exit
66
 
67
	cmp ah,61 ;+
68
	jne @f
69
	    fld dword[scale]
70
	    fadd dword[delt_sc]
71
	    fstp dword[scale]
72
	    call draw_3d
8069 IgorA 73
	    call [kosglSwapBuffers]
74
		jmp still
5218 IgorA 75
	@@:
76
	cmp ah,45 ;-
77
	jne @f
78
	    fld dword[scale]
79
	    fsub dword[delt_sc]
80
	    fstp dword[scale]
81
	    call draw_3d
8069 IgorA 82
	    call [kosglSwapBuffers]
83
		jmp still
5218 IgorA 84
	@@:
85
	cmp ah,178 ;Up
86
	jne @f
87
		fld dword[angle_y]
88
		fadd dword[delt_size]
89
		fstp dword[angle_y]
90
		call draw_3d
8069 IgorA 91
		call [kosglSwapBuffers]
92
		jmp still
5218 IgorA 93
	@@:
94
	cmp ah,177 ;Down
95
	jne @f
96
		fld dword[angle_y]
97
		fsub dword[delt_size]
98
		fstp dword[angle_y]
99
		call draw_3d
8069 IgorA 100
		call [kosglSwapBuffers]
101
		jmp still
5218 IgorA 102
	@@:
103
	cmp ah,176 ;Left
104
	jne @f
105
		fld dword[angle_z]
106
		fadd dword[delt_size]
107
		fstp dword[angle_z]
108
		call draw_3d
8069 IgorA 109
		call [kosglSwapBuffers]
110
		jmp still
5218 IgorA 111
	@@:
112
	cmp ah,179 ;Right
113
	jne @f
114
		fld dword[angle_z]
115
		fsub dword[delt_size]
116
		fstp dword[angle_z]
117
		call draw_3d
8069 IgorA 118
		call [kosglSwapBuffers]
119
		;jmp still
5218 IgorA 120
	@@:
121
 
122
	jmp still
123
 
124
align 4
125
button:
8069 IgorA 126
	mcall SF_GET_BUTTON
5218 IgorA 127
	cmp ah,1
128
	jne still
129
.exit:
130
	stdcall [gluDeleteQuadric], [qObj]
8069 IgorA 131
	mcall SF_TERMINATE_PROCESS
5218 IgorA 132
 
133
 
134
align 4
135
caption db 'Test gluSphere, [Esc] - exit, [<-],[->],[Up],[Down] - rotate',0
136
 
137
align 4
138
draw_3d:
139
stdcall [glClear], GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT ;очистим буфер цвета и глубины
140
 
141
stdcall [glColor3f], 1.0, 1.0, 0.0
142
 
8069 IgorA 143
call [glPushMatrix]
5218 IgorA 144
	stdcall [glTranslatef], 0.0,0.0,0.5
145
	stdcall [glScalef], [scale], [scale], [scale]
146
 
147
	stdcall [glRotatef], [angle_z],0.0,0.0,1.0
148
	stdcall [glRotatef], [angle_y],0.0,1.0,0.0
149
	stdcall [gluSphere], [qObj], 1.0, 16,16
150
 
151
	stdcall [glColor3f], 1.0, 0.0, 0.0
152
	stdcall [glTranslatef], -1.6,0.0,0.0
153
	stdcall [gluSphere], [qObj], 0.55, 8,8
154
 
155
	stdcall [glColor3f], 0.0, 0.0, 1.0
156
	stdcall [glTranslatef], 3.2,0.0,0.0
157
	stdcall [gluSphere], [qObj], 0.55, 8,8
8069 IgorA 158
call [glPopMatrix]
5218 IgorA 159
ret
160
 
8069 IgorA 161
align 4
5218 IgorA 162
qObj dd 0
163
 
164
scale dd 0.4
165
delt_sc dd 0.05
166
angle_z dd 0.0
167
angle_y dd 0.0
168
delt_size dd 3.0
169
 
170
;--------------------------------------------------
171
align 4
8408 IgorA 172
import_tinygl:
5218 IgorA 173
 
174
macro E_LIB n
175
{
176
	n dd sz_#n
177
}
178
include '../export.inc'
179
	dd 0,0
180
macro E_LIB n
181
{
182
	sz_#n db `n,0
183
}
184
include '../export.inc'
185
 
186
;--------------------------------------------------
187
system_path db '/sys/lib/'
188
name_tgl db 'tinygl.obj',0
189
;--------------------------------------------------
190
 
8069 IgorA 191
align 16
5218 IgorA 192
i_end:
8408 IgorA 193
	ctx1 rb 28 ;sizeof.TinyGLContext = 28
194
cur_dir_path rb 4096
195
library_path rb 4096
8069 IgorA 196
	rb 2048
5218 IgorA 197
stacktop:
198
mem: