2014-11-22 20:14:55 +01:00
|
|
|
use32
|
2020-09-14 23:31:00 +02:00
|
|
|
org 0
|
2014-11-22 20:14:55 +01:00
|
|
|
db 'MENUET01'
|
2020-09-14 23:31:00 +02:00
|
|
|
dd 1,start,i_end,mem,stacktop,0,cur_dir_path
|
|
|
|
|
|
|
|
include '../../../../../proc32.inc'
|
|
|
|
include '../../../../../macros.inc'
|
|
|
|
include '../../../../../KOSfuncs.inc'
|
2020-12-14 17:48:32 +01:00
|
|
|
include '../../../../../load_lib.mac'
|
2020-09-14 23:31:00 +02:00
|
|
|
include '../../../../../dll.inc'
|
2014-11-22 20:14:55 +01:00
|
|
|
include '../opengl_const.inc'
|
|
|
|
|
|
|
|
@use_library
|
|
|
|
|
|
|
|
align 4
|
|
|
|
start:
|
2020-12-14 17:48:32 +01:00
|
|
|
load_library name_tgl, library_path, system_path, import_lib_tinygl
|
2020-09-14 23:31:00 +02:00
|
|
|
cmp eax,SF_TERMINATE_PROCESS
|
2014-11-22 20:14:55 +01:00
|
|
|
jz button.exit
|
|
|
|
|
2020-09-14 23:31:00 +02:00
|
|
|
mcall SF_SET_EVENTS_MASK,0x27
|
2014-11-22 20:14:55 +01:00
|
|
|
|
|
|
|
stdcall [kosglMakeCurrent], 10,10,300,225,ctx1
|
2014-11-25 00:05:55 +01:00
|
|
|
;stdcall [glEnable], GL_DEPTH_TEST
|
2014-11-22 20:14:55 +01:00
|
|
|
stdcall [glClearColor], 0.2,0.0,0.2,0.0
|
2014-11-25 00:05:55 +01:00
|
|
|
;stdcall [glShadeModel],GL_FLAT
|
2014-11-22 20:14:55 +01:00
|
|
|
|
|
|
|
call draw_3d
|
|
|
|
|
|
|
|
align 4
|
|
|
|
red_win:
|
|
|
|
call draw_window
|
|
|
|
|
2020-09-14 23:31:00 +02:00
|
|
|
align 16
|
2014-11-22 20:14:55 +01:00
|
|
|
still:
|
2020-09-19 21:57:00 +02:00
|
|
|
mcall SF_WAIT_EVENT
|
2014-11-22 20:14:55 +01:00
|
|
|
cmp al,1
|
|
|
|
jz red_win
|
|
|
|
cmp al,2
|
|
|
|
jz key
|
|
|
|
cmp al,3
|
|
|
|
jz button
|
|
|
|
jmp still
|
|
|
|
|
|
|
|
align 4
|
|
|
|
draw_window:
|
|
|
|
pushad
|
2020-09-14 23:31:00 +02:00
|
|
|
mcall SF_REDRAW,SSF_BEGIN_DRAW
|
2014-11-22 20:14:55 +01:00
|
|
|
|
|
|
|
mov edx,0x33ffffff ;0x73ffffff
|
2020-09-14 23:31:00 +02:00
|
|
|
mcall SF_CREATE_WINDOW,(50 shl 16)+330,(30 shl 16)+275,,,caption
|
|
|
|
call [kosglSwapBuffers]
|
2014-11-22 20:14:55 +01:00
|
|
|
|
2020-09-14 23:31:00 +02:00
|
|
|
mcall SF_REDRAW,SSF_END_DRAW
|
2014-11-22 20:14:55 +01:00
|
|
|
popad
|
|
|
|
ret
|
|
|
|
|
|
|
|
align 4
|
|
|
|
key:
|
2020-09-14 23:31:00 +02:00
|
|
|
mcall SF_GET_KEY
|
2014-11-22 20:14:55 +01:00
|
|
|
|
|
|
|
cmp ah,27 ;Esc
|
|
|
|
je button.exit
|
|
|
|
|
|
|
|
;178 ;Up
|
|
|
|
;177 ;Down
|
|
|
|
cmp ah,176 ;Left
|
|
|
|
jne @f
|
|
|
|
fld dword[angle_z]
|
|
|
|
fadd dword[delt_size]
|
|
|
|
fstp dword[angle_z]
|
|
|
|
call draw_3d
|
2020-09-14 23:31:00 +02:00
|
|
|
call [kosglSwapBuffers]
|
2020-09-19 21:57:00 +02:00
|
|
|
jmp still
|
2014-11-22 20:14:55 +01:00
|
|
|
@@:
|
|
|
|
cmp ah,179 ;Right
|
|
|
|
jne @f
|
|
|
|
fld dword[angle_z]
|
|
|
|
fsub dword[delt_size]
|
|
|
|
fstp dword[angle_z]
|
|
|
|
call draw_3d
|
2020-09-14 23:31:00 +02:00
|
|
|
call [kosglSwapBuffers]
|
2020-09-19 21:57:00 +02:00
|
|
|
;jmp still
|
2014-11-22 20:14:55 +01:00
|
|
|
@@:
|
|
|
|
|
|
|
|
jmp still
|
|
|
|
|
|
|
|
align 4
|
|
|
|
button:
|
2020-09-14 23:31:00 +02:00
|
|
|
mcall SF_GET_BUTTON
|
2014-11-22 20:14:55 +01:00
|
|
|
cmp ah,1
|
|
|
|
jne still
|
|
|
|
.exit:
|
2020-09-14 23:31:00 +02:00
|
|
|
mcall SF_TERMINATE_PROCESS
|
2014-11-22 20:14:55 +01:00
|
|
|
|
|
|
|
|
|
|
|
align 4
|
|
|
|
caption db 'Test tinygl library, [Esc] - exit, [<-] and [->] - rotate',0
|
|
|
|
|
|
|
|
align 4
|
|
|
|
draw_3d:
|
|
|
|
stdcall [glClear], GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT ;очистим буфер цвета и глубины
|
|
|
|
|
2020-09-14 23:31:00 +02:00
|
|
|
call [glPushMatrix]
|
2014-11-22 20:14:55 +01:00
|
|
|
stdcall [glRotatef], [angle_z],0.0,0.0,1.0
|
|
|
|
|
2014-11-25 00:05:55 +01:00
|
|
|
stdcall [glBegin],GL_TRIANGLES
|
|
|
|
|
|
|
|
stdcall [glColor3f],0.0, 0.0, 1.0
|
|
|
|
stdcall [glVertex3f], 0.0, 0.5, 0.1
|
|
|
|
stdcall [glVertex3f], 0.475, 0.823, 0.1
|
|
|
|
stdcall [glVertex3f], 0.433, 0.25, 0.1
|
|
|
|
|
|
|
|
stdcall [glColor3f],0.0, 1.0, 0.0
|
|
|
|
stdcall [glVertex3f], 0.5, 0.0, 0.1
|
|
|
|
stdcall [glVertex3f], 0.823,-0.475, 0.1
|
|
|
|
stdcall [glVertex3f], 0.25, -0.433, 0.1
|
2014-11-22 20:14:55 +01:00
|
|
|
|
|
|
|
stdcall [glColor3f],1.0, 0.0, 0.0
|
2014-11-25 00:05:55 +01:00
|
|
|
stdcall [glVertex3f], 0.0, -0.5, 0.1
|
|
|
|
stdcall [glVertex3f], -0.475,-0.823,0.1
|
|
|
|
stdcall [glVertex3f], -0.433,-0.25, 0.1
|
|
|
|
|
|
|
|
stdcall [glVertex3f], -0.5, 0.0, 0.1
|
|
|
|
stdcall [glColor3f],1.0, 1.0, 0.0
|
|
|
|
stdcall [glVertex3f], -0.823, 0.475, 0.1
|
|
|
|
stdcall [glColor3f],1.0, 1.0, 1.0
|
|
|
|
stdcall [glVertex3f], -0.25, 0.433, 0.1
|
|
|
|
|
2020-09-19 21:57:00 +02:00
|
|
|
call [glEnd]
|
2014-11-22 20:14:55 +01:00
|
|
|
|
2020-09-19 21:57:00 +02:00
|
|
|
call [glPopMatrix]
|
2014-11-22 20:14:55 +01:00
|
|
|
ret
|
|
|
|
|
|
|
|
angle_z dd 15.0
|
|
|
|
delt_size dd 3.0
|
|
|
|
|
|
|
|
;--------------------------------------------------
|
|
|
|
align 4
|
|
|
|
import_lib_tinygl:
|
|
|
|
|
|
|
|
macro E_LIB n
|
|
|
|
{
|
|
|
|
n dd sz_#n
|
|
|
|
}
|
|
|
|
include '../export.inc'
|
|
|
|
dd 0,0
|
|
|
|
macro E_LIB n
|
|
|
|
{
|
|
|
|
sz_#n db `n,0
|
|
|
|
}
|
|
|
|
include '../export.inc'
|
|
|
|
|
|
|
|
;--------------------------------------------------
|
|
|
|
system_path db '/sys/lib/'
|
|
|
|
name_tgl db 'tinygl.obj',0
|
|
|
|
;--------------------------------------------------
|
|
|
|
|
2020-09-14 23:31:00 +02:00
|
|
|
align 16
|
2014-11-22 20:14:55 +01:00
|
|
|
i_end:
|
2020-12-14 17:48:32 +01:00
|
|
|
ctx1 rb 28 ;TinyGLContext or KOSGLContext
|
2020-09-14 23:31:00 +02:00
|
|
|
;sizeof.TinyGLContext = 28
|
2020-12-14 17:48:32 +01:00
|
|
|
cur_dir_path rb 4096
|
|
|
|
library_path rb 4096
|
2014-11-22 20:14:55 +01:00
|
|
|
rb 1024
|
|
|
|
stacktop:
|
2020-09-14 23:31:00 +02:00
|
|
|
mem:
|