Index: ddraw/glRenderer.cpp |
— | — | @@ -808,6 +808,8 @@ |
809 | 809 | glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
|
810 | 810 | glClear(GL_COLOR_BUFFER_BIT);
|
811 | 811 | glFlush();
|
| 812 | + SetScissor(false,0,0,0,0);
|
| 813 | + glDisable(GL_SCISSOR_TEST);
|
812 | 814 | SwapBuffers(hDC);
|
813 | 815 | SetActiveTexture(0);
|
814 | 816 | if(hWnd)
|
— | — | @@ -1216,13 +1218,6 @@ |
1217 | 1219 |
|
1218 | 1220 | void glRenderer::_Clear(glDirectDrawSurface7 *target, DWORD dwCount, LPD3DRECT lpRects, DWORD dwFlags, DWORD dwColor, D3DVALUE dvZ, DWORD dwStencil)
|
1219 | 1221 | {
|
1220 | | - if(dwCount)
|
1221 | | - {
|
1222 | | - outputs[0] = (void*)DDERR_INVALIDPARAMS;
|
1223 | | - FIXME("glDirect3DDevice7::Clear: Cannot clear rects yet.");
|
1224 | | - SetEvent(busy);
|
1225 | | - return;
|
1226 | | - }
|
1227 | 1222 | outputs[0] = (void*)D3D_OK;
|
1228 | 1223 | GLfloat color[4];
|
1229 | 1224 | dwordto4float(dwColor,color);
|
— | — | @@ -1244,7 +1239,16 @@ |
1245 | 1240 | clearbits |= GL_STENCIL_BUFFER_BIT;
|
1246 | 1241 | glClearStencil(dwStencil);
|
1247 | 1242 | }
|
1248 | | - glClear(clearbits);
|
| 1243 | + if(dwCount)
|
| 1244 | + {
|
| 1245 | + for(int i = 0; i < dwCount; i++)
|
| 1246 | + {
|
| 1247 | + SetScissor(true,lpRects[i].x1,lpRects[i].y1,lpRects[i].x2,lpRects[i].y2);
|
| 1248 | + glClear(clearbits);
|
| 1249 | + }
|
| 1250 | + SetScissor(false,0,0,0,0);
|
| 1251 | + }
|
| 1252 | + else glClear(clearbits);
|
1249 | 1253 | if(target->zbuffer) target->zbuffer->dirty |= 2;
|
1250 | 1254 | target->dirty |= 2;
|
1251 | 1255 | SetEvent(busy);
|
Index: ddraw/glutil.cpp |
— | — | @@ -25,6 +25,11 @@ |
26 | 26 | GLuint fbcolor = 0;
|
27 | 27 | GLuint fbz = 0;
|
28 | 28 | GLuint fbo = 0;
|
| 29 | +GLint scissorx = 0;
|
| 30 | +GLint scissory = 0;
|
| 31 | +GLsizei scissorwidth = 0;
|
| 32 | +GLsizei scissorheight = 0;
|
| 33 | +bool scissorenabled = false;
|
29 | 34 | bool stencil = false;
|
30 | 35 | GLint texlevel = 0;
|
31 | 36 | GLint texwrap[16];
|
— | — | @@ -188,4 +193,22 @@ |
189 | 194 | depthcomp = comp;
|
190 | 195 | glDepthFunc(comp);
|
191 | 196 | }
|
| 197 | +}
|
| 198 | +
|
| 199 | +void SetScissor(bool enabled, GLint x, GLint y, GLsizei width, GLsizei height)
|
| 200 | +{
|
| 201 | + if(enabled != scissorenabled)
|
| 202 | + {
|
| 203 | + scissorenabled = enabled;
|
| 204 | + if(enabled) glEnable(GL_SCISSOR_TEST);
|
| 205 | + else glDisable(GL_SCISSOR_TEST);
|
| 206 | + }
|
| 207 | + if((x != scissorx) || (y != scissory) || (width != scissorwidth) || (height != scissorheight))
|
| 208 | + {
|
| 209 | + scissorx = x;
|
| 210 | + scissory = y;
|
| 211 | + scissorwidth = width;
|
| 212 | + scissorheight = height;
|
| 213 | + glScissor(x,y,width,height);
|
| 214 | + }
|
192 | 215 | } |
\ No newline at end of file |
Index: ddraw/glutil.h |
— | — | @@ -31,5 +31,6 @@ |
32 | 32 | void SetDepthComp(GLenum comp);
|
33 | 33 | void DepthWrite(bool enabled);
|
34 | 34 | void DepthTest(bool enabled);
|
| 35 | +void SetScissor(bool enabled, GLint x, GLint y, GLsizei width, GLsizei height);
|
35 | 36 |
|
36 | 37 | #endif //_GLUTIL_H |
\ No newline at end of file |