Removed all the automatic batching stuff and replaced it with a more straight-forward implementation using a state cache for optimizing performances

git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1362 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
LaurentGom 2010-01-19 20:39:32 +00:00
parent 8ba9495c02
commit c237305f9b
58 changed files with 890 additions and 2039 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -70,11 +70,9 @@ namespace sample_opengl
window.Clear();
// Draw background
window.SaveGLStates();
window.Draw(background);
// Flush the window, to make sure that our OpenGL cube
// will be rendered on top of the background sprite
window.Flush();
window.RestoreGLStates();
// Activate the window before using OpenGL commands.
// This is useless here because we have only one window which is
@ -134,7 +132,9 @@ namespace sample_opengl
Gl.glEnd();
// Draw some text on top of our OpenGL object
window.SaveGLStates();
window.Draw(text);
window.RestoreGLStates();
// Finally, display the rendered frame on screen
window.Display();

View file

@ -194,22 +194,22 @@ namespace SFML
////////////////////////////////////////////////////////////
/// <summary>
/// Make sure that what has been drawn so far is rendered.
///
/// Use this function if you use OpenGL rendering commands,
/// and you want to make sure that things will appear on top
/// of all the SFML objects that have been drawn so far.
/// This is needed because SFML doesn't use immediate rendering,
/// it first accumulates drawables into a queue and
/// trigger the actual rendering afterwards.
///
/// You don't need to call this function if you're not
/// dealing with OpenGL directly.
/// Save the current OpenGL render states and matrices
/// </summary>
////////////////////////////////////////////////////////////
public void Flush()
public void SaveGLStates()
{
sfRenderImage_Flush(This);
sfRenderImage_SaveGLStates(This);
}
////////////////////////////////////////////////////////////
/// <summary>
/// Restore the previously saved OpenGL render states and matrices
/// </summary>
////////////////////////////////////////////////////////////
public void RestoreGLStates()
{
sfRenderImage_RestoreGLStates(This);
}
////////////////////////////////////////////////////////////
@ -305,7 +305,10 @@ namespace SFML
static extern bool sfRenderImage_SetActive(IntPtr This, bool Active);
[DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity]
static extern bool sfRenderImage_Flush(IntPtr This);
static extern bool sfRenderImage_SaveGLStates(IntPtr This);
[DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity]
static extern bool sfRenderImage_RestoreGLStates(IntPtr This);
[DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity]
static extern bool sfRenderImage_Display(IntPtr This);

View file

@ -108,20 +108,17 @@ namespace SFML
////////////////////////////////////////////////////////////
/// <summary>
/// Make sure that what has been drawn so far is rendered.
///
/// Use this function if you use OpenGL rendering commands,
/// and you want to make sure that things will appear on top
/// of all the SFML objects that have been drawn so far.
/// This is needed because SFML doesn't use immediate rendering,
/// it first accumulates drawables into a queue and
/// trigger the actual rendering afterwards.
///
/// You don't need to call this function if you're not
/// dealing with OpenGL directly.
/// Save the current OpenGL render states and matrices
/// </summary>
////////////////////////////////////////////////////////////
void Flush();
void SaveGLStates();
////////////////////////////////////////////////////////////
/// <summary>
/// Restore the previously saved OpenGL render states and matrices
/// </summary>
////////////////////////////////////////////////////////////
void RestoreGLStates();
}
}
}

View file

@ -407,22 +407,22 @@ namespace SFML
////////////////////////////////////////////////////////////
/// <summary>
/// Make sure that what has been drawn so far is rendered.
///
/// Use this function if you use OpenGL rendering commands,
/// and you want to make sure that things will appear on top
/// of all the SFML objects that have been drawn so far.
/// This is needed because SFML doesn't use immediate rendering,
/// it first accumulates drawables into a queue and
/// trigger the actual rendering afterwards.
///
/// You don't need to call this function if you're not
/// dealing with OpenGL directly.
/// Save the current OpenGL render states and matrices
/// </summary>
////////////////////////////////////////////////////////////
public void Flush()
public void SaveGLStates()
{
sfRenderWindow_Flush(This);
sfRenderWindow_SaveGLStates(This);
}
////////////////////////////////////////////////////////////
/// <summary>
/// Restore the previously saved OpenGL render states and matrices
/// </summary>
////////////////////////////////////////////////////////////
public void RestoreGLStates()
{
sfRenderWindow_RestoreGLStates(This);
}
////////////////////////////////////////////////////////////
@ -563,7 +563,10 @@ namespace SFML
static extern bool sfRenderWindow_SetActive(IntPtr This, bool Active);
[DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity]
static extern bool sfRenderWindow_Flush(IntPtr This);
static extern bool sfRenderWindow_SaveGLStates(IntPtr This);
[DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity]
static extern bool sfRenderWindow_RestoreGLStates(IntPtr This);
[DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity]
static extern void sfRenderWindow_SetFramerateLimit(IntPtr This, uint Limit);