Rev 6523 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6523 | Rev 8069 | ||
---|---|---|---|
Line 38... | Line 38... | ||
38 | ; resize the glx viewport : we try to use the xsize and ysize |
38 | ; resize the glx viewport : we try to use the xsize and ysize |
39 | ; given. We return the effective size which is guaranted to be smaller |
39 | ; given. We return the effective size which is guaranted to be smaller |
Line 40... | Line 40... | ||
40 | 40 | ||
41 | align 4 |
41 | align 4 |
42 | proc gl_resize_viewport uses ebx ecx edx edi esi, context:dword, xsize_ptr:dword, ysize_ptr:dword |
- | |
43 | xor eax,eax |
- | |
44 | 42 | proc gl_resize_viewport uses ebx ecx edx edi esi, context:dword, xsize_ptr:dword, ysize_ptr:dword |
|
45 | mov ecx,[xsize_ptr] ; ecx = &xsize |
43 | mov ecx,[xsize_ptr] ; ecx = &xsize |
46 | mov edi,[ecx] ; edi = xsize |
44 | mov edi,[ecx] ; edi = xsize |
47 | mov esi,[ysize_ptr] ; esi = &ysize |
45 | mov esi,[ysize_ptr] ; esi = &ysize |
Line 48... | Line -... | ||
48 | mov esi,[esi] ; esi = ysize |
- | |
49 | - | ||
50 | ; we ensure that xsize and ysize are multiples of 2 for the zbuffer. |
- | |
51 | ; TODO: find a better solution |
46 | mov esi,[esi] ; esi = ysize |
52 | and edi, not 3 |
- | |
53 | and esi, not 3 |
47 | |
54 | 48 | xor eax,eax |
|
55 | cmp edi,0 |
49 | or edi,edi |
56 | jne @f |
50 | jnz @f |
57 | cmp esi,0 |
51 | or esi,esi |
58 | jne @f |
52 | jnz @f |
59 | mov eax,-1 |
53 | mov eax,-1 |
Line 60... | Line 54... | ||
60 | jmp .end_f |
54 | jmp .end_f |
Line 66... | Line 60... | ||
66 | mov [ecx],esi |
60 | mov [ecx],esi |
67 | dec dword[ecx] |
61 | dec dword[ecx] |
Line 68... | Line 62... | ||
68 | 62 | ||
69 | mov ebx,[context] |
63 | mov ebx,[context] |
70 | mov edx,[ebx+GLContext.opaque] ; edx = (TinyGLContext *)context.opaque |
64 | mov edx,[ebx+GLContext.opaque] ; edx = (TinyGLContext *)context.opaque |
71 | mov [edx+4],edi |
65 | mov [edx+TinyGLContext.xsize],edi |
72 | mov [edx+12],edi ;d_x = xsize |
66 | mov [edx+TinyGLContext.d_x],edi |
73 | mov [edx+8],esi |
67 | mov [edx+TinyGLContext.ysize],esi |
Line 74... | Line 68... | ||
74 | mov [edx+16],esi ;d_y = ysize |
68 | mov [edx+TinyGLContext.d_y],esi |
75 | 69 | ||
76 | ; resize the Z buffer |
70 | ; resize the Z buffer |
77 | stdcall ZB_resize, dword[ebx+GLContext.zb],0,edi,esi |
71 | stdcall ZB_resize, dword[ebx+GLContext.zb],0,edi,esi |
Line 85... | Line 79... | ||
85 | mov ebx,[ctx1] |
79 | mov ebx,[ctx1] |
86 | cmp dword[ebx],0 ;if (ctx.gl_context == NULL) |
80 | cmp dword[ebx],0 ;if (ctx.gl_context == NULL) |
87 | jne .end_f |
81 | jne .end_f |
88 | ; create the TinyGL context |
82 | ; create the TinyGL context |
89 | mov ecx,[win_x0] |
83 | mov ecx,[win_x0] |
90 | mov [ebx+20],ecx ;ctx.x = win_x0 |
84 | mov [ebx+TinyGLContext.x],ecx |
91 | mov ecx,[win_y0] |
85 | mov ecx,[win_y0] |
92 | mov [ebx+24],ecx ;ctx.y = win_y0 |
86 | mov [ebx+TinyGLContext.y],ecx |
93 | mov ecx,[win_x] |
87 | mov ecx,[win_x] |
94 | mov [ebx+12],ecx ;ctx.d_x = win_x |
88 | mov [ebx+TinyGLContext.d_x],ecx |
95 | mov ecx,[win_y] |
89 | mov ecx,[win_y] |
96 | mov [ebx+16],ecx ;ctx.d_y = win_y |
90 | mov [ebx+TinyGLContext.d_y],ecx |
Line 97... | Line 91... | ||
97 | 91 | ||
98 | ; currently, we only support 16 bit rendering |
92 | ; currently, we only support 16 bit rendering |
99 | xor eax,eax |
93 | xor eax,eax |
Line 114... | Line 108... | ||
114 | 108 | ||
115 | mov [eax+GLContext.opaque],ebx ;ctx.gl_context.opaque = ctx |
109 | mov [eax+GLContext.opaque],ebx ;ctx.gl_context.opaque = ctx |
Line 116... | Line 110... | ||
116 | mov dword[eax+GLContext.gl_resize_viewport],gl_resize_viewport |
110 | mov dword[eax+GLContext.gl_resize_viewport],gl_resize_viewport |
117 | 111 | ||
118 | ; set the viewport : we force a call to gl_resize_viewport |
112 | ; set the viewport : we force a call to gl_resize_viewport |
Line 119... | Line 113... | ||
119 | dec dword[eax+GLContext.viewport+offs_vpor_xsize] |
113 | dec dword[eax+GLContext.viewport+GLViewport.xsize] |
120 | dec dword[eax+GLContext.viewport+offs_vpor_ysize] |
114 | dec dword[eax+GLContext.viewport+GLViewport.ysize] |
121 | 115 | ||
122 | stdcall glViewport, 0, 0, [win_x], [win_y] |
116 | stdcall glViewport, 0, 0, [win_x], [win_y] |
Line 130... | Line 124... | ||
130 | align 4 |
124 | align 4 |
131 | proc kosglSwapBuffers uses eax ebx ecx edx esi |
125 | proc kosglSwapBuffers uses eax ebx ecx edx esi |
132 | ; retrieve the current TinyGLContext |
126 | ; retrieve the current TinyGLContext |
133 | call gl_get_context |
127 | call gl_get_context |
134 | mov ebx,[eax+GLContext.zb] |
128 | mov ebx,[eax+GLContext.zb] |
135 | mov ebx,[ebx+offs_zbuf_pbuf] |
129 | mov ebx,[ebx+ZBuffer.pbuf] |
136 | mov esi,[eax+GLContext.opaque] ;esi = &context.opaque |
130 | mov esi,[eax+GLContext.opaque] ;esi = &context.opaque |
137 | mov eax,7 |
131 | mov eax,SF_PUT_IMAGE |
138 | mov ecx,[esi+12] ;d_x |
132 | mov ecx,[esi+TinyGLContext.d_x] |
139 | shl ecx,16 |
133 | shl ecx,16 |
140 | mov cx,[esi+16] ;d_y |
134 | mov cx,word[esi+TinyGLContext.d_y] |
141 | mov edx,[esi+20] ;x |
135 | mov edx,[esi+TinyGLContext.x] |
142 | shl edx,16 |
136 | shl edx,16 |
143 | mov dx,[esi+24] ;y |
137 | mov dx,word[esi+TinyGLContext.y] |
144 | int 0x40 |
138 | int 0x40 |
145 | ret |
139 | ret |
146 | endp |
140 | endp |