/programs/develop/libraries/TinyGL/asm_fork/examples/gears.asm |
---|
78,7 → 78,7 |
jge @f |
mov eax,120 ;min size |
@@: |
sub eax,42 |
sub eax,43 |
mov ebx,dword[procinfo.box.width] |
cmp ebx,200 |
jge @f |
91,8 → 91,10 |
align 16 |
still: |
call draw_3d |
cmp dword[stop],1 |
je @f |
stdcall Fps, 365,4 |
stdcall Fps, 365,4 |
mov dword[esp-4],eax |
fild dword[esp-4] |
fmul dword[a2] |
101,6 → 103,11 |
fstp dword[angle] |
mcall SF_CHECK_EVENT |
jmp .end0 |
align 4 |
@@: |
mcall SF_WAIT_EVENT |
.end0: |
cmp al,1 |
jz red_win |
cmp al,2 |
156,7 → 163,7 |
mcall SF_REDRAW,SSF_BEGIN_DRAW |
mcall SF_CREATE_WINDOW,(50 shl 16)+409,(30 shl 16)+425,0x33404040,,title1 |
stdcall [kosglSwapBuffers] |
call [kosglSwapBuffers] |
;Title |
mcall SF_DRAW_TEXT,(338 shl 16)+4,0xc0c0c0,fps, fps.end-fps |
179,7 → 186,7 |
fld dword[scale] |
fdiv dword[delt_sc] |
fstp dword[scale] |
call draw_3d |
jmp still |
@@: |
cmp ah,61 ;= |
jne @f |
186,7 → 193,7 |
fld dword[scale] |
fdiv dword[delt_sc] |
fstp dword[scale] |
call draw_3d |
jmp still |
@@: |
cmp ah,45 ;- |
jne @f |
193,14 → 200,19 |
fld dword[scale] |
fmul dword[delt_sc] |
fstp dword[scale] |
call draw_3d |
jmp still |
@@: |
cmp ah,112 ;P |
jne @f |
xor dword[stop],1 |
jmp still |
@@: |
cmp ah,178 ;Up |
jne @f |
fld dword[view_rotx] |
fadd dword[delt_size] |
fstp dword[view_rotx] |
call draw_3d |
jmp still |
@@: |
cmp ah,177 ;Down |
jne @f |
207,7 → 219,7 |
fld dword[view_rotx] |
fsub dword[delt_size] |
fstp dword[view_rotx] |
call draw_3d |
jmp still |
@@: |
cmp ah,176 ;Left |
jne @f |
214,7 → 226,7 |
fld dword[view_roty] |
fadd dword[delt_size] |
fstp dword[view_roty] |
call draw_3d |
jmp still |
@@: |
cmp ah,179 ;Right |
jne @f |
221,7 → 233,7 |
fld dword[view_roty] |
fsub dword[delt_size] |
fstp dword[view_roty] |
call draw_3d |
jmp still |
@@: |
jmp still |
237,10 → 249,10 |
align 4 |
title1: db 'TinyGL in KolibriOS' |
.end: db 0 |
title2: db 'F full screen' |
;title2: db 'F full screen' |
;.end: db 0 |
title3: db 'ESC - exit, Arrow keys - rotate, +/- zoom, P - pause' |
.end: db 0 |
title3: db 'ESC - exit Arrow keys - rotate +/- zoom' |
.end: db 0 |
fps: db 'FPS:' |
.end: db 0 |
248,19 → 260,19 |
draw_3d: |
stdcall [glClear], GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT |
stdcall [glPushMatrix] |
call [glPushMatrix] |
stdcall [glScalef], [scale], [scale], [scale] |
stdcall [glRotatef], [view_rotx], 1.0, 0.0, 0.0 |
stdcall [glRotatef], [view_roty], 0.0, 1.0, 0.0 |
stdcall [glRotatef], [view_rotz], 0.0, 0.0, 1.0 |
stdcall [glPushMatrix] |
call [glPushMatrix] |
stdcall [glTranslatef], -3.0, -2.0, 0.0 |
stdcall [glRotatef], [angle], 0.0, 0.0, 1.0 |
stdcall [glCallList],[gear1] |
stdcall [glPopMatrix] |
call [glPopMatrix] |
stdcall [glPushMatrix] |
call [glPushMatrix] |
stdcall [glTranslatef], 3.1, -2.0, 0.0 |
push dword 1.0 |
push dword 0.0 |
277,9 → 289,9 |
sub esp,4 |
call [glRotatef] ;, -2.0*angle-9.0, 0.0, 0.0, 1.0 |
stdcall [glCallList],[gear2] |
stdcall [glPopMatrix] |
call [glPopMatrix] |
stdcall [glPushMatrix] |
call [glPushMatrix] |
stdcall [glTranslatef], -3.1, 4.2, 0.0 |
push dword 1.0 |
push dword 0.0 |
296,11 → 308,11 |
sub esp,4 |
call [glRotatef] ;, -2.0*angle-25.0, 0.0, 0.0, 1.0 |
stdcall [glCallList],[gear3] |
stdcall [glPopMatrix] |
call [glPopMatrix] |
stdcall [glPopMatrix] |
call [glPopMatrix] |
stdcall [kosglSwapBuffers] |
call [kosglSwapBuffers] |
; count++; |
; if (count==limit) { |
330,6 → 342,7 |
limit dd ? |
count dd 1 |
stop dd 0 ;пауза |
; |
; Draw a gear wheel. You'll probably want to call this function when |
/programs/develop/libraries/TinyGL/asm_fork/examples/test0.asm |
---|
33,7 → 33,7 |
align 16 |
still: |
mcall SF_CHECK_EVENT |
mcall SF_WAIT_EVENT |
cmp al,1 |
jz red_win |
cmp al,2 |
71,6 → 71,7 |
fstp dword[angle_z] |
call draw_3d |
call [kosglSwapBuffers] |
jmp still |
@@: |
cmp ah,179 ;Right |
jne @f |
79,6 → 80,7 |
fstp dword[angle_z] |
call draw_3d |
call [kosglSwapBuffers] |
;jmp still |
@@: |
jmp still |
/programs/develop/libraries/TinyGL/asm_fork/examples/test1.asm |
---|
32,7 → 32,7 |
align 16 |
still: |
mcall SF_CHECK_EVENT |
mcall SF_WAIT_EVENT |
cmp al,1 |
jz red_win |
cmp al,2 |
70,6 → 70,7 |
fstp dword[angle_z] |
call draw_3d |
call [kosglSwapBuffers] |
jmp still |
@@: |
cmp ah,179 ;Right |
jne @f |
78,6 → 79,7 |
fstp dword[angle_z] |
call draw_3d |
call [kosglSwapBuffers] |
;jmp still |
@@: |
jmp still |
114,7 → 116,7 |
stdcall [glVertex3f], -0.636,-0.636, 0.1 |
stdcall [glVertex3f], -0.9, 0.0, 0.1 |
stdcall [glVertex3f], -0.636, 0.636, 0.1 |
stdcall [glEnd] |
call [glEnd] |
stdcall [glBegin],GL_LINE_LOOP |
stdcall [glVertex3f], 0.0, 1.1, 0.1 |
125,7 → 127,7 |
stdcall [glVertex3f], -0.778, -0.778, 0.1 |
stdcall [glVertex3f], -2.1, 0.0, 0.1 |
stdcall [glVertex3f], -0.778, 0.778, 0.1 |
stdcall [glEnd] |
call [glEnd] |
call [glPopMatrix] |
ret |
/programs/develop/libraries/TinyGL/asm_fork/examples/test2.asm |
---|
62,7 → 62,7 |
align 16 |
still: |
mcall SF_CHECK_EVENT |
mcall SF_WAIT_EVENT |
cmp al,1 |
jz red_win |
cmp al,2 |
100,6 → 100,7 |
fstp dword[angle_z] |
call draw_3d |
call [kosglSwapBuffers] |
jmp still |
@@: |
cmp ah,179 ;Right |
jne @f |
108,6 → 109,7 |
fstp dword[angle_z] |
call draw_3d |
call [kosglSwapBuffers] |
;jmp still |
@@: |
jmp still |
134,7 → 136,7 |
stdcall [glCallList],[obj1] |
stdcall [glPopMatrix] |
call [glPopMatrix] |
ret |
align 4 |
/programs/develop/libraries/TinyGL/asm_fork/examples/test3.asm |
---|
34,7 → 34,7 |
align 16 |
still: |
mcall SF_CHECK_EVENT |
mcall SF_WAIT_EVENT |
cmp al,1 |
jz red_win |
cmp al,2 |
72,6 → 72,7 |
fstp dword[angle_z] |
call draw_3d |
call [kosglSwapBuffers] |
jmp still |
@@: |
cmp ah,179 ;Right |
jne @f |
80,6 → 81,7 |
fstp dword[angle_z] |
call draw_3d |
call [kosglSwapBuffers] |
;jmp still |
@@: |
jmp still |
126,9 → 128,9 |
stdcall [glColor3f],1.0, 1.0, 1.0 |
stdcall [glVertex3f], -0.25, 0.433, 0.1 |
stdcall [glEnd] |
call [glEnd] |
stdcall [glPopMatrix] |
call [glPopMatrix] |
ret |
angle_z dd 15.0 |
/programs/develop/libraries/TinyGL/asm_fork/examples/test_glu0.asm |
---|
1,16 → 1,13 |
use32 |
org 0x0 |
org 0 |
db 'MENUET01' |
dd 0x1 |
dd start |
dd i_end |
dd mem,stacktop |
dd 0,cur_dir_path |
dd 1,start,i_end,mem,stacktop,0,cur_dir_path |
include '../../../../../../programs/proc32.inc' |
include '../../../../../../programs/macros.inc' |
include '../../../../../../programs/develop/libraries/box_lib/load_lib.mac' |
include '../../../../../../programs/dll.inc' |
include '../../../../../proc32.inc' |
include '../../../../../macros.inc' |
include '../../../../../KOSfuncs.inc' |
include '../../../../../develop/libraries/box_lib/load_lib.mac' |
include '../../../../../dll.inc' |
include '../opengl_const.inc' |
@use_library |
19,10 → 16,10 |
start: |
load_library name_tgl, cur_dir_path, library_path, system_path, \ |
err_message_found_lib, head_f_l, import_lib_tinygl, err_message_import, head_f_i |
cmp eax,-1 |
cmp eax,SF_TERMINATE_PROCESS |
jz button.exit |
mcall 40,0x27 |
mcall SF_SET_EVENTS_MASK,0x27 |
stdcall [kosglMakeCurrent], 10,10,300,225,ctx1 |
stdcall [glEnable], GL_DEPTH_TEST |
37,9 → 34,9 |
red_win: |
call draw_window |
align 4 |
align 16 |
still: |
mcall 10 |
mcall SF_WAIT_EVENT |
cmp al,1 |
jz red_win |
cmp al,2 |
51,19 → 48,19 |
align 4 |
draw_window: |
pushad |
mcall 12,1 |
mcall SF_REDRAW,SSF_BEGIN_DRAW |
mov edx,0x33ffffff ;0x73ffffff |
mcall 0,(50 shl 16)+330,(30 shl 16)+275,,,caption |
stdcall [kosglSwapBuffers] |
mcall SF_CREATE_WINDOW,(50 shl 16)+330,(30 shl 16)+275,,,caption |
call [kosglSwapBuffers] |
mcall 12,2 |
mcall SF_REDRAW,SSF_END_DRAW |
popad |
ret |
align 4 |
key: |
mcall 2 |
mcall SF_GET_KEY |
cmp ah,27 ;Esc |
je button.exit |
74,7 → 71,8 |
fadd dword[delt_sc] |
fstp dword[scale] |
call draw_3d |
stdcall [kosglSwapBuffers] |
call [kosglSwapBuffers] |
jmp still |
@@: |
cmp ah,45 ;- |
jne @f |
82,7 → 80,8 |
fsub dword[delt_sc] |
fstp dword[scale] |
call draw_3d |
stdcall [kosglSwapBuffers] |
call [kosglSwapBuffers] |
jmp still |
@@: |
cmp ah,178 ;Up |
jne @f |
90,7 → 89,8 |
fadd dword[delt_size] |
fstp dword[angle_y] |
call draw_3d |
stdcall [kosglSwapBuffers] |
call [kosglSwapBuffers] |
jmp still |
@@: |
cmp ah,177 ;Down |
jne @f |
98,7 → 98,8 |
fsub dword[delt_size] |
fstp dword[angle_y] |
call draw_3d |
stdcall [kosglSwapBuffers] |
call [kosglSwapBuffers] |
jmp still |
@@: |
cmp ah,176 ;Left |
jne @f |
106,7 → 107,8 |
fadd dword[delt_size] |
fstp dword[angle_z] |
call draw_3d |
stdcall [kosglSwapBuffers] |
call [kosglSwapBuffers] |
jmp still |
@@: |
cmp ah,179 ;Right |
jne @f |
114,7 → 116,8 |
fsub dword[delt_size] |
fstp dword[angle_z] |
call draw_3d |
stdcall [kosglSwapBuffers] |
call [kosglSwapBuffers] |
;jmp still |
@@: |
jmp still |
121,19 → 124,16 |
align 4 |
button: |
mcall 17 |
mcall SF_GET_BUTTON |
cmp ah,1 |
jne still |
.exit: |
stdcall [gluDeleteQuadric], [qObj] |
mcall -1 |
mcall SF_TERMINATE_PROCESS |
align 4 |
caption db 'Test gluSphere, [Esc] - exit, [<-],[->],[Up],[Down] - rotate',0 |
align 4 |
ctx1 db 28 dup (0) ;TinyGLContext or KOSGLContext |
;sizeof.TinyGLContext = 28 |
align 4 |
draw_3d: |
141,7 → 141,7 |
stdcall [glColor3f], 1.0, 1.0, 0.0 |
stdcall [glPushMatrix] |
call [glPushMatrix] |
stdcall [glTranslatef], 0.0,0.0,0.5 |
stdcall [glScalef], [scale], [scale], [scale] |
156,9 → 156,10 |
stdcall [glColor3f], 0.0, 0.0, 1.0 |
stdcall [glTranslatef], 3.2,0.0,0.0 |
stdcall [gluSphere], [qObj], 0.55, 8,8 |
stdcall [glPopMatrix] |
call [glPopMatrix] |
ret |
align 4 |
qObj dd 0 |
scale dd 0.4 |
186,14 → 187,18 |
;-------------------------------------------------- |
system_path db '/sys/lib/' |
name_tgl db 'tinygl.obj',0 |
err_message_found_lib db 'Sorry I cannot load library tinygl.obj',0 |
head_f_i: |
head_f_l db 'System error',0 |
err_message_import db 'Error on load import library tinygl.obj',0 |
head_f_l db '"System error',0 |
err_message_import db 'Error on load import library ',39,'tinygl.obj',39,'" -tE',0 |
err_message_found_lib db 'Sorry I cannot load library ',39,'tinygl.obj',39,'" -tE',0 |
;-------------------------------------------------- |
align 16 |
i_end: |
rb 1024 |
ctx1 db 28 dup (0) ;TinyGLContext or KOSGLContext |
;sizeof.TinyGLContext = 28 |
rb 2048 |
stacktop: |
cur_dir_path: |
rb 4096 |