Home / comp / gb.opengl / gl / newlist 
Gl.NewList (gb.opengl)
Syntax
STATIC SUB NewList ( Index AS Integer, Mode AS Integer )

Create or replace a display list

Parameters

Description

  Display lists are groups of GL commands that have been stored for subsequent execution. The display lists are created with

  Gl.NewList has two arguments. The first argument, Index, is a positive integer that becomes the unique name for the display list. Names can be created and reserved with Gl.GenLists and tested for uniqueness with Gl.IsList. The second argument, Mode, is a symbolic constant that can assume one of two values:

Examples

From the example OpenGL -> GambasGears

' We need 3 displaylists for the 3 gears gearlists = Gl.GenLists(3) Gl.NewList(gearlists, Gl.GL_COMPILE) Gl.Materialfv(Gl.GL_FRONT, Gl.GL_AMBIENT_AND_DIFFUSE, red) Gear(1.0, 4.0, 1.0, 20, 0.7) Gl.EndList() Gl.NewList(gearlists + 1, Gl.GL_COMPILE) Gl.Materialfv(Gl.GL_FRONT, Gl.GL_AMBIENT_AND_DIFFUSE, green) Gear(0.5, 2.0, 2.0, 10, 0.7) Gl.EndList() Gl.NewList(gearlists + 2, Gl.GL_COMPILE) Gl.Materialfv(Gl.GL_FRONT, Gl.GL_AMBIENT_AND_DIFFUSE, blue) Gear(1.3, 2.0, 0.5, 10, 0.7) Gl.EndList()

  Certain commands are not compiled into the display list, but are executed immediately, regardless of the display-list mode. These commands are Gl.IsList, Gl.GenLists, Gl.DeleteLists, Gl.FeedbackBuffer, Gl.SelectBuffer, Gl.RenderMode, Gl.ReadPixels, Gl.PixelStore, Gl.Flush, Gl.Finish, Gl.IsEnabled, and all of the routines to get GL values.

  When Gl.EndList is encountered, the display-list definition is completed by associating the list with the unique name list (specified in the Gl.NewList command). If a display list with name list already exists, it is replaced only when Gl.EndList is called.

Gl.CallList and Gl.CallLists can be entered into display lists. The commands in the display list or lists executed by Gl.CallList or Gl.CallLists are not included in the display list being created, even if the list creation mode is Gl.GL_COMPILE_AND_EXECUTE.

Errors

Gl.GL_INVALID_VALUE is generated if list is zero.
Gl.GL_INVALID_ENUM is generated if mode is not an accepted value.
Gl.GL_INVALID_OPERATION is generated if Gl.EndList is called without a preceding Gl.NewList, or if Gl.NewList is called while a display list is being defined.
Gl.GL_INVALID_OPERATION is generated if Gl.NewList is called between a call to Gl.Begin and the corresponding call to Gl.End.

Associated Gets

Gl.IsList

See also

Gl.CallList , Gl.CallLists , Gl.DeleteLists , Gl.GenLists , Gl.EndList