Browse Source

gpu: temporarily enable alpha blending in the vertex buffer code.

legacy
Sam Hocevar sam 13 years ago
parent
commit
cbf13dac65
2 changed files with 21 additions and 7 deletions
  1. +21
    -2
      src/gpu/vertexbuffer.cpp
  2. +0
    -5
      src/video.cpp

+ 21
- 2
src/gpu/vertexbuffer.cpp View File

@@ -123,6 +123,9 @@ void VertexDeclaration::Bind()
void VertexDeclaration::DrawElements(MeshPrimitive type, int skip, int count) void VertexDeclaration::DrawElements(MeshPrimitive type, int skip, int count)
{ {
#if defined _XBOX || defined USE_D3D9 #if defined _XBOX || defined USE_D3D9
g_d3ddevice->SetRenderState(D3DRS_ALPHABLENDENABLE, 1);
g_d3ddevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
g_d3ddevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
if (FAILED(g_d3ddevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CW))) if (FAILED(g_d3ddevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CW)))
Abort(); Abort();
switch (type) switch (type)
@@ -133,6 +136,13 @@ void VertexDeclaration::DrawElements(MeshPrimitive type, int skip, int count)
break; break;
} }
#else #else
# if defined HAVE_GL_2X && !defined __APPLE__
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GEQUAL, 0.01f);
# endif
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

switch (type) switch (type)
{ {
case MeshPrimitive::Triangles: case MeshPrimitive::Triangles:
@@ -147,8 +157,10 @@ void VertexDeclaration::DrawIndexedElements(MeshPrimitive type, int vbase,
int skip, int count) int skip, int count)
{ {
#if defined _XBOX || defined USE_D3D9 #if defined _XBOX || defined USE_D3D9
if (FAILED(g_d3ddevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CW)))
Abort();
g_d3ddevice->SetRenderState(D3DRS_ALPHABLENDENABLE, 1);
g_d3ddevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
g_d3ddevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
g_d3ddevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CW);
switch (type) switch (type)
{ {
case MeshPrimitive::Triangles: case MeshPrimitive::Triangles:
@@ -157,6 +169,13 @@ void VertexDeclaration::DrawIndexedElements(MeshPrimitive type, int vbase,
break; break;
} }
#else #else
# if defined HAVE_GL_2X && !defined __APPLE__
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GEQUAL, 0.01f);
# endif
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

switch (type) switch (type)
{ {
case MeshPrimitive::Triangles: case MeshPrimitive::Triangles:


+ 0
- 5
src/video.cpp View File

@@ -131,10 +131,6 @@ void Video::Setup(ivec2 size)
} }


g_d3ddevice = VideoData::d3d_dev; g_d3ddevice = VideoData::d3d_dev;

g_d3ddevice->SetRenderState(D3DRS_ALPHABLENDENABLE, 1);
g_d3ddevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
g_d3ddevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
#else #else
# if defined USE_GLEW && !defined __APPLE__ # if defined USE_GLEW && !defined __APPLE__
/* Initialise GLEW if necessary */ /* Initialise GLEW if necessary */
@@ -154,7 +150,6 @@ void Video::Setup(ivec2 size)
glClearDepth(1.0); glClearDepth(1.0);


# if defined HAVE_GL_2X && !defined __APPLE__ # if defined HAVE_GL_2X && !defined __APPLE__
glShadeModel(GL_SMOOTH);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
# endif # endif
#endif #endif


Loading…
Cancel
Save