Skip to content

Commit

Permalink
UPBGE: Remove 2d filter vertex transformation.
Browse files Browse the repository at this point in the history
Removing the vertex tranformation avoid doing extra call
to setup identity projection and modelview matrices.
  • Loading branch information
panzergame committed Aug 8, 2016
1 parent a7ed66a commit 6b47c01
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
11 changes: 11 additions & 0 deletions doc/python_api/rst/bge_types/bge.types.KX_2DFilter.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,17 @@ base class --- :class:`BL_Shader`

2D filter shader object. Can be alterated with :class:`BL_Shader`'s functions.

.. warning::

The vertex shader must not apply modelview and projection transformation. It should be similar to:

.. code-block:: glsl
void main()
{
gl_Position = gl_Vertex;
}
.. method:: setTexture(index, bindCode, samplerName)

Set specified texture bind code :data:`bindCode` in specified slot :data:`index`. Any call to :data:`setTexture`
Expand Down
10 changes: 0 additions & 10 deletions source/gameengine/Rasterizer/RAS_2DFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,17 +337,7 @@ void RAS_2DFilter::DrawOverlayPlane(RAS_IRasterizer *rasty, RAS_ICanvas *canvas)

rasty->SetLines(false);

rasty->PushMatrix();
rasty->LoadIdentity();
rasty->SetMatrixMode(RAS_IRasterizer::RAS_PROJECTION);
rasty->PushMatrix();
rasty->LoadIdentity();

rasty->DrawOverlayPlane();

rasty->PopMatrix();
rasty->SetMatrixMode(RAS_IRasterizer::RAS_MODELVIEW);
rasty->PopMatrix();

rasty->Enable(RAS_IRasterizer::RAS_DEPTH_TEST);
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ static const char *VertexShader = STRINGIFY(

void main(void)
{
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
gl_Position = gl_Vertex;
gl_TexCoord[0] = gl_MultiTexCoord0;
}
);
Expand Down

0 comments on commit 6b47c01

Please sign in to comment.