Subversion Repositories Kolibri OS

Rev

Rev 5218 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5218 Rev 8069
Line 1... Line 1...
1
use32
1
use32
2
	org 0x0
2
	org 0
3
	db 'MENUET01'
3
	db 'MENUET01'
4
	dd 0x1
-
 
5
	dd start
-
 
6
	dd i_end
-
 
7
	dd mem,stacktop
-
 
8
	dd 0,cur_dir_path
4
	dd 1,start,i_end,mem,stacktop,0,cur_dir_path
9
 
5
 
10
include '../../../../../../programs/proc32.inc'
6
include '../../../../../proc32.inc'
11
include '../../../../../../programs/macros.inc'
7
include '../../../../../macros.inc'
-
 
8
include '../../../../../KOSfuncs.inc'
12
include '../../../../../../programs/develop/libraries/box_lib/load_lib.mac'
9
include '../../../../../develop/libraries/box_lib/load_lib.mac'
13
include '../../../../../../programs/dll.inc'
10
include '../../../../../dll.inc'
14
include '../opengl_const.inc'
11
include '../opengl_const.inc'
Line 15... Line 12...
15
 
12
 
Line 16... Line 13...
16
@use_library
13
@use_library
17
 
14
 
18
align 4
15
align 4
19
start:
16
start:
20
	load_library name_tgl, cur_dir_path, library_path, system_path, \
17
	load_library name_tgl, cur_dir_path, library_path, system_path, \
21
		err_message_found_lib, head_f_l, import_lib_tinygl, err_message_import, head_f_i
18
		err_message_found_lib, head_f_l, import_lib_tinygl, err_message_import, head_f_i
Line 22... Line 19...
22
	cmp eax,-1
19
	cmp eax,SF_TERMINATE_PROCESS
Line 23... Line 20...
23
	jz button.exit
20
	jz button.exit
24
 
21
 
25
	mcall 40,0x27
22
	mcall SF_SET_EVENTS_MASK,0x27
26
 
23
 
Line 35... Line 32...
35
 
32
 
36
align 4
33
align 4
37
red_win:
34
red_win:
Line 38... Line 35...
38
	call draw_window
35
	call draw_window
39
 
36
 
40
align 4
37
align 16
41
still:
38
still:
42
	mcall 10
39
	mcall SF_WAIT_EVENT
43
	cmp al,1
40
	cmp al,1
44
	jz red_win
41
	jz red_win
45
	cmp al,2
42
	cmp al,2
Line 49... Line 46...
49
	jmp still
46
	jmp still
Line 50... Line 47...
50
 
47
 
51
align 4
48
align 4
52
draw_window:
49
draw_window:
53
	pushad
50
	pushad
Line 54... Line 51...
54
	mcall 12,1
51
	mcall SF_REDRAW,SSF_BEGIN_DRAW
55
 
52
 
56
	mov edx,0x33ffffff ;0x73ffffff
53
	mov edx,0x33ffffff ;0x73ffffff
Line 57... Line 54...
57
	mcall 0,(50 shl 16)+330,(30 shl 16)+275,,,caption
54
	mcall SF_CREATE_WINDOW,(50 shl 16)+330,(30 shl 16)+275,,,caption
58
	stdcall [kosglSwapBuffers]
55
	call [kosglSwapBuffers]
59
 
56
 
Line 60... Line 57...
60
	mcall 12,2
57
	mcall SF_REDRAW,SSF_END_DRAW
61
	popad
58
	popad
62
	ret
59
	ret
Line 63... Line 60...
63
 
60
 
64
align 4
61
align 4
Line 65... Line 62...
65
key:
62
key:
66
	mcall 2
63
	mcall SF_GET_KEY
67
 
64
 
68
	cmp ah,27 ;Esc
65
	cmp ah,27 ;Esc
69
	je button.exit
66
	je button.exit
70
 
67
 
71
	cmp ah,61 ;+
68
	cmp ah,61 ;+
-
 
69
	jne @f
72
	jne @f
70
	    fld dword[scale]
73
	    fld dword[scale]
71
	    fadd dword[delt_sc]
74
	    fadd dword[delt_sc]
72
	    fstp dword[scale]
75
	    fstp dword[scale]
73
	    call draw_3d
76
	    call draw_3d
74
	    call [kosglSwapBuffers]
77
	    stdcall [kosglSwapBuffers]
75
		jmp still
78
	@@:
76
	@@:
79
	cmp ah,45 ;-
77
	cmp ah,45 ;-
-
 
78
	jne @f
80
	jne @f
79
	    fld dword[scale]
81
	    fld dword[scale]
80
	    fsub dword[delt_sc]
82
	    fsub dword[delt_sc]
81
	    fstp dword[scale]
83
	    fstp dword[scale]
82
	    call draw_3d
84
	    call draw_3d
83
	    call [kosglSwapBuffers]
85
	    stdcall [kosglSwapBuffers]
84
		jmp still
86
	@@:
85
	@@:
87
	cmp ah,178 ;Up
86
	cmp ah,178 ;Up
-
 
87
	jne @f
88
	jne @f
88
		fld dword[angle_y]
89
		fld dword[angle_y]
89
		fadd dword[delt_size]
90
		fadd dword[delt_size]
90
		fstp dword[angle_y]
91
		fstp dword[angle_y]
91
		call draw_3d
92
		call draw_3d
92
		call [kosglSwapBuffers]
93
		stdcall [kosglSwapBuffers]
93
		jmp still
94
	@@:
94
	@@:
95
	cmp ah,177 ;Down
95
	cmp ah,177 ;Down
-
 
96
	jne @f
96
	jne @f
97
		fld dword[angle_y]
97
		fld dword[angle_y]
98
		fsub dword[delt_size]
98
		fsub dword[delt_size]
99
		fstp dword[angle_y]
99
		fstp dword[angle_y]
100
		call draw_3d
100
		call draw_3d
101
		call [kosglSwapBuffers]
101
		stdcall [kosglSwapBuffers]
102
		jmp still
102
	@@:
103
	@@:
103
	cmp ah,176 ;Left
104
	cmp ah,176 ;Left
-
 
105
	jne @f
104
	jne @f
106
		fld dword[angle_z]
105
		fld dword[angle_z]
107
		fadd dword[delt_size]
106
		fadd dword[delt_size]
108
		fstp dword[angle_z]
107
		fstp dword[angle_z]
109
		call draw_3d
108
		call draw_3d
110
		call [kosglSwapBuffers]
109
		stdcall [kosglSwapBuffers]
111
		jmp still
110
	@@:
112
	@@:
111
	cmp ah,179 ;Right
113
	cmp ah,179 ;Right
-
 
114
	jne @f
112
	jne @f
115
		fld dword[angle_z]
Line 113... Line 116...
113
		fld dword[angle_z]
116
		fsub dword[delt_size]
Line 114... Line 117...
114
		fsub dword[delt_size]
117
		fstp dword[angle_z]
115
		fstp dword[angle_z]
118
		call draw_3d
116
		call draw_3d
119
		call [kosglSwapBuffers]
117
		stdcall [kosglSwapBuffers]
120
		;jmp still
118
	@@:
121
	@@:
119
 
122
 
120
	jmp still
123
	jmp still
121
 
124
 
Line 122... Line 125...
122
align 4
125
align 4
123
button:
126
button:
124
	mcall 17
-
 
125
	cmp ah,1
-
 
126
	jne still
-
 
Line 127... Line 127...
127
.exit:
127
	mcall SF_GET_BUTTON
128
	stdcall [gluDeleteQuadric], [qObj]
128
	cmp ah,1
129
	mcall -1
129
	jne still
Line 130... Line 130...
130
 
130
.exit:
Line 131... Line 131...
131
 
131
	stdcall [gluDeleteQuadric], [qObj]
132
align 4
132
	mcall SF_TERMINATE_PROCESS
133
caption db 'Test gluSphere, [Esc] - exit, [<-],[->],[Up],[Down] - rotate',0
133
 
Line 134... Line 134...
134
align 4
134
 
135
ctx1 db 28 dup (0) ;TinyGLContext or KOSGLContext
135
align 4
Line 154... Line 154...
154
	stdcall [gluSphere], [qObj], 0.55, 8,8
154
	stdcall [gluSphere], [qObj], 0.55, 8,8
Line 155... Line 155...
155
 
155
 
156
	stdcall [glColor3f], 0.0, 0.0, 1.0
156
	stdcall [glColor3f], 0.0, 0.0, 1.0
157
	stdcall [glTranslatef], 3.2,0.0,0.0
157
	stdcall [glTranslatef], 3.2,0.0,0.0
158
	stdcall [gluSphere], [qObj], 0.55, 8,8
158
	stdcall [gluSphere], [qObj], 0.55, 8,8
159
stdcall [glPopMatrix]
159
call [glPopMatrix]
Line -... Line 160...
-
 
160
ret
160
ret
161
 
Line 161... Line 162...
161
 
162
align 4
162
qObj dd 0
163
qObj dd 0
163
 
164
 
Line 184... Line 185...
184
include '../export.inc'
185
include '../export.inc'
Line 185... Line 186...
185
 
186
 
186
;--------------------------------------------------
187
;--------------------------------------------------
187
system_path db '/sys/lib/'
188
system_path db '/sys/lib/'
188
name_tgl db 'tinygl.obj',0
-
 
-
 
189
name_tgl db 'tinygl.obj',0
189
err_message_found_lib db 'Sorry I cannot load library tinygl.obj',0
190
 
190
head_f_i:
191
head_f_i:
191
head_f_l db 'System error',0
192
head_f_l db '"System error',0
-
 
193
err_message_import db 'Error on load import library ',39,'tinygl.obj',39,'" -tE',0
192
err_message_import db 'Error on load import library tinygl.obj',0
194
err_message_found_lib db 'Sorry I cannot load library ',39,'tinygl.obj',39,'" -tE',0
Line -... Line 195...
-
 
195
;--------------------------------------------------
193
;--------------------------------------------------
196
 
-
 
197
align 16
-
 
198
i_end:
194
 
199
ctx1 db 28 dup (0) ;TinyGLContext or KOSGLContext
195
i_end:
200
;sizeof.TinyGLContext = 28
196
	rb 1024
201
	rb 2048
197
stacktop:
202
stacktop:
198
cur_dir_path:
203
cur_dir_path:
199
	rb 4096
204
	rb 4096