Index: ddraw/glDirect3D.cpp |
— | — | @@ -47,7 +47,7 @@ |
48 | 48 | D3DPBLENDCAPS_SRCALPHASAT | D3DPBLENDCAPS_BOTHSRCALPHA | D3DPBLENDCAPS_BOTHINVSRCALPHA, //dwDestBlendCaps
|
49 | 49 | 0, //dwAlphaCmpCaps
|
50 | 50 | D3DPSHADECAPS_COLORGOURAUDRGB, //dwShadeCaps
|
51 | | - D3DPTEXTURECAPS_PERSPECTIVE, //dwTextureCaps
|
| 51 | + D3DPTEXTURECAPS_ALPHA | D3DPTEXTURECAPS_PERSPECTIVE, //dwTextureCaps
|
52 | 52 | D3DPTFILTERCAPS_NEAREST | D3DPTFILTERCAPS_LINEAR | D3DPTFILTERCAPS_MIPNEAREST |
|
53 | 53 | D3DPTFILTERCAPS_MIPLINEAR | D3DPTFILTERCAPS_LINEARMIPNEAREST | D3DPTFILTERCAPS_LINEARMIPLINEAR |
|
54 | 54 | D3DPTFILTERCAPS_MAGFLINEAR | D3DPTFILTERCAPS_MAGFPOINT | D3DPTFILTERCAPS_MINFLINEAR |
|
— | — | @@ -74,7 +74,7 @@ |
75 | 75 | D3DPBLENDCAPS_SRCALPHASAT | D3DPBLENDCAPS_BOTHSRCALPHA | D3DPBLENDCAPS_BOTHINVSRCALPHA, //dwDestBlendCaps
|
76 | 76 | 0, //dwAlphaCmpCaps
|
77 | 77 | D3DPSHADECAPS_COLORGOURAUDRGB, //dwShadeCaps
|
78 | | - D3DPTEXTURECAPS_PERSPECTIVE, //dwTextureCaps
|
| 78 | + D3DPTEXTURECAPS_ALPHA | D3DPTEXTURECAPS_PERSPECTIVE, //dwTextureCaps
|
79 | 79 | D3DPTFILTERCAPS_NEAREST | D3DPTFILTERCAPS_LINEAR | D3DPTFILTERCAPS_MIPNEAREST |
|
80 | 80 | D3DPTFILTERCAPS_MIPLINEAR | D3DPTFILTERCAPS_LINEARMIPNEAREST | D3DPTFILTERCAPS_LINEARMIPLINEAR |
|
81 | 81 | D3DPTFILTERCAPS_MAGFLINEAR | D3DPTFILTERCAPS_MAGFPOINT | D3DPTFILTERCAPS_MINFLINEAR |
|
— | — | @@ -94,7 +94,7 @@ |
95 | 95 | 0, //dwMaxTextureHeight
|
96 | 96 | 0, //dwMaxTextureRepeat
|
97 | 97 | 0, //dwMaxTextureAspectRatio
|
98 | | - 0, //dwMaxAnisotropy
|
| 98 | + 1, //dwMaxAnisotropy
|
99 | 99 | 0.0f, //dvGuardBandLeft
|
100 | 100 | 0.0f, //dvGuardBandTop
|
101 | 101 | 0.0f, //dvGuardBandRight
|
Index: ddraw/glDirectDraw.cpp |
— | — | @@ -1462,8 +1462,8 @@ |
1463 | 1463 | }
|
1464 | 1464 | glDirectDraw1::~glDirectDraw1()
|
1465 | 1465 | {
|
| 1466 | + glDD7->glDD1 = NULL;
|
1466 | 1467 | glDD7->Release();
|
1467 | | - glDD7->glDD1 = NULL;
|
1468 | 1468 | }
|
1469 | 1469 | HRESULT WINAPI glDirectDraw1::QueryInterface(REFIID riid, void** ppvObj)
|
1470 | 1470 | {
|
— | — | @@ -1610,8 +1610,8 @@ |
1611 | 1611 | }
|
1612 | 1612 | glDirectDraw2::~glDirectDraw2()
|
1613 | 1613 | {
|
| 1614 | + glDD7->glDD2 = NULL;
|
1614 | 1615 | glDD7->Release();
|
1615 | | - glDD7->glDD2 = NULL;
|
1616 | 1616 | }
|
1617 | 1617 | HRESULT WINAPI glDirectDraw2::QueryInterface(REFIID riid, void** ppvObj)
|
1618 | 1618 | {
|
— | — | @@ -1769,8 +1769,8 @@ |
1770 | 1770 | }
|
1771 | 1771 | glDirectDraw4::~glDirectDraw4()
|
1772 | 1772 | {
|
| 1773 | + glDD7->glDD4 = NULL;
|
1773 | 1774 | glDD7->Release();
|
1774 | | - glDD7->glDD4 = NULL;
|
1775 | 1775 | }
|
1776 | 1776 | HRESULT WINAPI glDirectDraw4::QueryInterface(REFIID riid, void** ppvObj)
|
1777 | 1777 | {
|
Index: ddraw/glRenderer.cpp |
— | — | @@ -784,6 +784,8 @@ |
785 | 785 | glFlush();
|
786 | 786 | SetScissor(false,0,0,0,0);
|
787 | 787 | glDisable(GL_SCISSOR_TEST);
|
| 788 | + SetCull(D3DCULL_CCW);
|
| 789 | + glEnable(GL_CULL_FACE);
|
788 | 790 | SwapBuffers(hDC);
|
789 | 791 | SetActiveTexture(0);
|
790 | 792 | if(hWnd)
|
— | — | @@ -946,6 +948,7 @@ |
947 | 949 | EnableArray(shaders[progtype].texcoord,true);
|
948 | 950 | glVertexAttribPointer(shaders[progtype].texcoord,2,GL_FLOAT,false,sizeof(BltVertex),&bltvertices[0].s);
|
949 | 951 | }
|
| 952 | + SetCull(D3DCULL_NONE);
|
950 | 953 | glDrawRangeElements(GL_TRIANGLE_STRIP,0,3,4,GL_UNSIGNED_SHORT,bltindices);
|
951 | 954 | SetFBO(0,0,false);
|
952 | 955 | if(((ddsd.ddsCaps.dwCaps & (DDSCAPS_FRONTBUFFER)) &&
|
— | — | @@ -1004,6 +1007,7 @@ |
1005 | 1008 | glVertexAttribPointer(shaders[progtype].pos,2,GL_FLOAT,false,sizeof(BltVertex),&bltvertices[0].x);
|
1006 | 1009 | EnableArray(shaders[progtype].texcoord,true);
|
1007 | 1010 | glVertexAttribPointer(shaders[progtype].texcoord,2,GL_FLOAT,false,sizeof(BltVertex),&bltvertices[0].s);
|
| 1011 | + SetCull(D3DCULL_NONE);
|
1008 | 1012 | glDrawRangeElements(GL_TRIANGLE_STRIP,0,3,4,GL_UNSIGNED_SHORT,bltindices);
|
1009 | 1013 | SetFBO(0,0,false);
|
1010 | 1014 | }
|
— | — | @@ -1119,6 +1123,7 @@ |
1120 | 1124 | EnableArray(shaders[progtype].rgb,true);
|
1121 | 1125 | glVertexAttribPointer(shaders[progtype].rgb,3,GL_UNSIGNED_BYTE,true,sizeof(BltVertex),&bltvertices[0].r);
|
1122 | 1126 | }
|
| 1127 | + SetCull(D3DCULL_NONE);
|
1123 | 1128 | glDrawRangeElements(GL_TRIANGLE_STRIP,0,3,4,GL_UNSIGNED_SHORT,bltindices);
|
1124 | 1129 | glFlush();
|
1125 | 1130 | if(hWnd) SwapBuffers(hDC);
|
— | — | @@ -1546,6 +1551,7 @@ |
1547 | 1552 | if(device->renderstate[D3DRENDERSTATE_ALPHABLENDENABLE]) BlendEnable(true);
|
1548 | 1553 | else BlendEnable(false);
|
1549 | 1554 | SetBlend(device->renderstate[D3DRENDERSTATE_SRCBLEND],device->renderstate[D3DRENDERSTATE_DESTBLEND]);
|
| 1555 | + SetCull((D3DCULL)device->renderstate[D3DRENDERSTATE_CULLMODE]);
|
1550 | 1556 | if(indices) glDrawElements(mode,indexcount,GL_UNSIGNED_SHORT,indices);
|
1551 | 1557 | else glDrawArrays(mode,0,count);
|
1552 | 1558 | if(device->glDDS7->zbuffer) device->glDDS7->zbuffer->dirty |= 2;
|
Index: ddraw/glutil.cpp |
— | — | @@ -55,6 +55,8 @@ |
56 | 56 | GLenum blenddest = GL_ZERO;
|
57 | 57 | bool blendenabled = false;
|
58 | 58 | bool arrays[42];
|
| 59 | +D3DCULL cullmode = D3DCULL_NONE;
|
| 60 | +bool cullenabled = false;
|
59 | 61 |
|
60 | 62 | void InitFBO()
|
61 | 63 | {
|
— | — | @@ -357,4 +359,35 @@ |
358 | 360 | if(enabled) glEnable(GL_BLEND);
|
359 | 361 | else glDisable(GL_BLEND);
|
360 | 362 | }
|
| 363 | +}
|
| 364 | +
|
| 365 | +void EnableCull(bool enabled)
|
| 366 | +{
|
| 367 | + if(cullenabled != enabled)
|
| 368 | + {
|
| 369 | + cullenabled = enabled;
|
| 370 | + if(enabled) glEnable(GL_CULL_FACE);
|
| 371 | + else glDisable(GL_CULL_FACE);
|
| 372 | + }
|
| 373 | +}
|
| 374 | +void SetCull(D3DCULL mode)
|
| 375 | +{
|
| 376 | + if(cullmode != mode)
|
| 377 | + {
|
| 378 | + cullmode = mode;
|
| 379 | + switch(mode)
|
| 380 | + {
|
| 381 | + case D3DCULL_CCW:
|
| 382 | + EnableCull(true);
|
| 383 | + glFrontFace(GL_CCW);
|
| 384 | + break;
|
| 385 | + case D3DCULL_CW:
|
| 386 | + EnableCull(true);
|
| 387 | + glFrontFace(GL_CW);
|
| 388 | + break;
|
| 389 | + case D3DCULL_NONE:
|
| 390 | + EnableCull(false);
|
| 391 | + break;
|
| 392 | + }
|
| 393 | + }
|
361 | 394 | } |
\ No newline at end of file |
Index: ddraw/glutil.h |
— | — | @@ -43,5 +43,7 @@ |
44 | 44 | void EnableArray(int index, bool enabled);
|
45 | 45 | void BlendFunc(GLenum src, GLenum dest);
|
46 | 46 | void BlendEnable(bool enabled);
|
| 47 | +void EnableCull(bool enabled);
|
| 48 | +void SetCull(D3DCULL mode);
|
47 | 49 |
|
48 | 50 | #endif //_GLUTIL_H |
\ No newline at end of file |