Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 8173 → Rev 8174

/programs/develop/libraries/TinyGL/asm_fork/examples/test_glu1.asm
1,5 → 1,5
use32
org 0x0
org 0
db 'MENUET01'
dd 1,start,i_end,mem,stacktop,0,cur_dir_path
 
8,6 → 8,7
include '../../../../../KOSfuncs.inc'
include '../../../../../load_img.inc'
include '../opengl_const.inc'
include '../zbuffer.inc'
include '../../../../../develop/info3ds/info_fun_float.inc'
 
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
16,7 → 17,11
image_data_toolbar dd 0
IMAGE_TOOLBAR_ICON_SIZE equ 21*21*3
 
offs_zbuf_pbuf equ 24 ;const. from 'zbuffer.inc'
;Макрос для параметров типа double (8 байт)
macro glpush GLDoubleVar {
push dword[GLDoubleVar+4]
push dword[GLDoubleVar]
}
 
align 4
start:
38,7 → 43,7
stdcall [kosglMakeCurrent], 5,30,[buf_ogl.w],[buf_ogl.h],ctx1
stdcall [glEnable], GL_DEPTH_TEST
stdcall [glEnable], GL_NORMALIZE ;делам нормали одинаковой величины во избежание артефактов
stdcall [gluNewQuadric]
call [gluNewQuadric]
mov [qObj],eax
 
stdcall [glClearColor], 0.25,0.25,0.25,0.0
46,7 → 51,7
 
mov eax,dword[ctx1] ;eax -> TinyGLContext.GLContext
mov eax,[eax] ;eax -> ZBuffer
mov eax,[eax+offs_zbuf_pbuf] ;eax -> ZBuffer.pbuf
mov eax,[eax+ZBuffer.pbuf]
mov dword[buf_ogl],eax
 
load_image_file 'font8x9.bmp', image_data_toolbar, buf_1.w,buf_1.h
96,7 → 101,7
add ebx,IMAGE_TOOLBAR_ICON_SIZE
mcall ,,,(125 shl 16)+5 ;масштаб -
 
stdcall [kosglSwapBuffers]
call [kosglSwapBuffers]
mcall SF_REDRAW,SSF_END_DRAW
popad
ret
130,7 → 135,8
mov byte[txt_angle_y.v],0
stdcall str_cat, txt_angle_y.v,Data_String
call draw_3d
stdcall [kosglSwapBuffers]
call [kosglSwapBuffers]
jmp still
@@:
cmp ah,177 ;Down
jne @f
144,7 → 150,8
mov byte[txt_angle_y.v],0
stdcall str_cat, txt_angle_y.v,Data_String
call draw_3d
stdcall [kosglSwapBuffers]
call [kosglSwapBuffers]
jmp still
@@:
cmp ah,176 ;Left
jne @f
158,7 → 165,8
mov byte[txt_angle_z.v],0
stdcall str_cat, txt_angle_z.v,Data_String
call draw_3d
stdcall [kosglSwapBuffers]
call [kosglSwapBuffers]
jmp still
@@:
cmp ah,179 ;Right
jne @f
172,7 → 180,8
mov byte[txt_angle_z.v],0
stdcall str_cat, txt_angle_z.v,Data_String
call draw_3d
stdcall [kosglSwapBuffers]
call [kosglSwapBuffers]
;jmp still
@@:
 
jmp still
216,7 → 225,7
but_st_point:
stdcall [gluQuadricDrawStyle], [qObj],GLU_POINT
call draw_3d
stdcall [kosglSwapBuffers]
call [kosglSwapBuffers]
ret
 
align 4
223,7 → 232,7
but_st_line:
stdcall [gluQuadricDrawStyle], [qObj],GLU_LINE
call draw_3d
stdcall [kosglSwapBuffers]
call [kosglSwapBuffers]
ret
 
align 4
230,7 → 239,7
but_st_face:
stdcall [gluQuadricDrawStyle], [qObj],GLU_FILL
call draw_3d
stdcall [kosglSwapBuffers]
call [kosglSwapBuffers]
ret
 
align 4
253,7 → 262,7
mov byte[txt_scale.v],0
stdcall str_cat, txt_scale.v,Data_String
call draw_3d
stdcall [kosglSwapBuffers]
call [kosglSwapBuffers]
ret
 
align 4
276,16 → 285,14
mov byte[txt_scale.v],0
stdcall str_cat, txt_scale.v,Data_String
call draw_3d
stdcall [kosglSwapBuffers]
call [kosglSwapBuffers]
ret
 
 
align 4
caption db 'Test gluCylinder, [Esc] - exit, [<-],[->],[Up],[Down] - rotate',0
 
align 4
ctx1 db 28 dup (0) ;TinyGLContext or KOSGLContext
;sizeof.TinyGLContext = 28
 
rad1 dq 1.0
rad2 dq 0.55
rad3 dq 0.15
296,7 → 303,7
draw_3d:
stdcall [glClear], GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT ;очистим буфер цвета и глубины
 
stdcall [glPushMatrix]
call [glPushMatrix]
call SetLight
 
stdcall [glTranslatef], 0.0,0.0,0.5
316,7 → 323,7
stdcall [glColor3f], 0.0, 0.0, 1.0
stdcall [glTranslatef], 3.2,0.0,0.0
stdcall [gluCylinder], [qObj], rad2,rad3,hei2, 16,8
stdcall [glPopMatrix]
call [glPopMatrix]
 
stdcall [buf2d_draw_text], buf_ogl, buf_1,txt_scale,5,5,0xffff00
stdcall [buf2d_draw_text], buf_ogl, buf_1,txt_angle_z,5,15,0xffff00
341,8 → 348,6
stdcall [glEnable],GL_LIGHT0
ret
 
qObj dd 0
 
scale dd 0.4 ;начальный масштаб
sc_delt dd 0.05 ;изменение масштаба при нажатии
sc_min dd 0.1 ;минимальный масштаб
432,49 → 437,51
align 4
import_libimg:
dd alib_init1
img_is_img dd aimg_is_img
img_info dd aimg_info
img_from_file dd aimg_from_file
img_to_file dd aimg_to_file
img_from_rgb dd aimg_from_rgb
img_to_rgb dd aimg_to_rgb
; img_is_img dd aimg_is_img
; img_info dd aimg_info
; img_from_file dd aimg_from_file
; img_to_file dd aimg_to_file
; img_from_rgb dd aimg_from_rgb
; img_to_rgb dd aimg_to_rgb
img_to_rgb2 dd aimg_to_rgb2
img_decode dd aimg_decode
img_encode dd aimg_encode
img_create dd aimg_create
; img_encode dd aimg_encode
; img_create dd aimg_create
img_destroy dd aimg_destroy
img_destroy_layer dd aimg_destroy_layer
img_count dd aimg_count
img_lock_bits dd aimg_lock_bits
img_unlock_bits dd aimg_unlock_bits
img_flip dd aimg_flip
img_flip_layer dd aimg_flip_layer
img_rotate dd aimg_rotate
img_rotate_layer dd aimg_rotate_layer
img_draw dd aimg_draw
; img_destroy_layer dd aimg_destroy_layer
; img_count dd aimg_count
; img_lock_bits dd aimg_lock_bits
; img_unlock_bits dd aimg_unlock_bits
; img_flip dd aimg_flip
; img_flip_layer dd aimg_flip_layer
; img_rotate dd aimg_rotate
; img_rotate_layer dd aimg_rotate_layer
; img_draw dd aimg_draw
; img_convert dd aimg_convert
 
dd 0,0
alib_init1 db 'lib_init',0
aimg_is_img db 'img_is_img',0 ;определяет по данным, может ли библиотека сделать из них изображение
aimg_info db 'img_info',0
aimg_from_file db 'img_from_file',0
aimg_to_file db 'img_to_file',0
aimg_from_rgb db 'img_from_rgb',0
aimg_to_rgb db 'img_to_rgb',0 ;преобразование изображения в данные RGB
; aimg_is_img db 'img_is_img',0 ;определяет по данным, может ли библиотека сделать из них изображение
; aimg_info db 'img_info',0
; aimg_from_file db 'img_from_file',0
; aimg_to_file db 'img_to_file',0
; aimg_from_rgb db 'img_from_rgb',0
; aimg_to_rgb db 'img_to_rgb',0 ;преобразование изображения в данные RGB
aimg_to_rgb2 db 'img_to_rgb2',0
aimg_decode db 'img_decode',0 ;автоматически определяет формат графических данных
aimg_encode db 'img_encode',0
aimg_create db 'img_create',0
; aimg_encode db 'img_encode',0
; aimg_create db 'img_create',0
aimg_destroy db 'img_destroy',0
aimg_destroy_layer db 'img_destroy_layer',0
aimg_count db 'img_count',0
aimg_lock_bits db 'img_lock_bits',0
aimg_unlock_bits db 'img_unlock_bits',0
aimg_flip db 'img_flip',0
aimg_flip_layer db 'img_flip_layer',0
aimg_rotate db 'img_rotate',0
aimg_rotate_layer db 'img_rotate_layer',0
aimg_draw db 'img_draw',0
; aimg_destroy_layer db 'img_destroy_layer',0
; aimg_count db 'img_count',0
; aimg_lock_bits db 'img_lock_bits',0
; aimg_unlock_bits db 'img_unlock_bits',0
; aimg_flip db 'img_flip',0
; aimg_flip_layer db 'img_flip_layer',0
; aimg_rotate db 'img_rotate',0
; aimg_rotate_layer db 'img_rotate_layer',0
; aimg_draw db 'img_draw',0
; aimg_convert db 'img_convert',0
 
;--------------------------------------------------
system_dir_0 db '/sys/lib/'
483,14 → 490,14
lib_name_1 db 'buf2d.obj',0
system_dir_2 db '/sys/lib/'
lib_name_2 db 'libimg.obj',0
err_msg_found_lib_0 db 'Sorry I cannot load library ',39,'tinygl.obj',39,0
err_msg_found_lib_1 db 'Sorry I cannot load library ',39,'buf2d.obj',39,0
err_msg_found_lib_2 db 'Sorry I cannot load library ',39,'libimg.obj',39,0
err_msg_found_lib_0 db 'Sorry I cannot load library ',39,'tinygl.obj',39,'" -tE',0
err_msg_found_lib_1 db 'Sorry I cannot load library ',39,'buf2d.obj',39,'" -tE',0
err_msg_found_lib_2 db 'Sorry I cannot load library ',39,'libimg.obj',39,'" -tE',0
head_f_i:
head_f_l db 'System error',0
err_msg_import_0 db 'Error on load import library ',39,'tinygl.obj',39,0
err_msg_import_1 db 'Error on load import library ',39,'buf2d.obj',39,0
err_msg_import_2 db 'Error on load import library ',39,'libimg.obj',39,0
head_f_l db '"System error',0
err_msg_import_0 db 'Error on load import library ',39,'tinygl.obj',39,'" -tE',0
err_msg_import_1 db 'Error on load import library ',39,'buf2d.obj',39,'" -tE',0
err_msg_import_2 db 'Error on load import library ',39,'libimg.obj',39,'" -tE',0
;--------------------------------------------------
 
txt_scale:
538,6 → 545,8
 
align 4
i_end:
ctx1 rb 28 ;sizeof.TinyGLContext = 28
qObj dd 0
run_file_70 FileInfoBlock
sc system_colors
align 16