#region --- License ---
/* Copyright (c) 2006, 2007 Stefanos Apostolopoulos
* See license.txt for license info
*/
#endregion
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenTK.OpenGL
{
///
/// Provides methods to create and render a display list.
///
[Obsolete("Use OpenGL methods directly, instead.")]
public class DisplayList : IDisposable
{
#region --- Private variables ---
private int id = -1;
#endregion
#region --- Constructors ---
///
/// Allocates a new DisplayList.
///
public DisplayList()
{
Id = GL.GenLists(1);
}
#endregion
#region --- Public properties ---
///
/// Gets the display list number.
///
public int Id
{
get { return id; }
private set { id = value; }
}
#endregion
#region --- Public methods ---
///
/// Starts recording elements into the display list.
///
public void Begin()
{
GL.NewList(Id, GL.Enums.ListMode.COMPILE);
}
///
/// Starts recording elements into the display list.
///
/// Sets if the list is to be compiled or compiled and executed immediately.
public void Begin(GL.Enums.ListMode listMode)
{
GL.NewList(Id, listMode);
}
///
/// Stops recording elements into the display list.
///
public void End()
{
GL.EndList();
}
///
/// Renders the display list elements.
///
public void Render()
{
GL.CallList(Id);
}
#endregion
#region --- IDisposable Members ---
public void Dispose()
{
if (Id > 0)
GL.DeleteLists(Id, 1);
Id = -1;
}
#endregion
}
}