341 344














Open GL Super Bible:3D Modeling and Object Composition















To access the contents, click the chapter and section titles.


Open GL Super Bible


(Publisher: Macmillan Computer Publishing)

Author(s): Waite group Press

ISBN: 1571690735

Publication Date: 08/01/96

 




Previous
Table of Contents
Next




glGenLists

Purpose
Generates a continuous range of empty display lists.
Include File
<gl.h>
Syntax
GLuint glGenLists(GLsizei range);
Description
This function creates a range of empty display lists. The number of lists generated depends on the value specified in range. The return value is then the first
display list in this range of empty display lists. The purpose of this
function is to reserve a range of display list values for future use.


Parameters


range

GLsizei: The number of empty display lists requested.
Returns
The first display list of the range requested.
The display list values following the return value up to range -1 are
created empty.


Example
The following code allocates an array of 25 integers that will be used to store 25 display lists. Each element in the array must be assigned a valid display list name that can be used later.

int lists[25]; // Space for 25 display lists
int first; // Index of the first display list name
available
int x; // Looping variable



// Get the first display list identifier
first = glGenLists(25);
// Loop and assign each element in the array with a valid display
list
for(x = 0; x < 25; x++)
lists[25] = first + x + 1;


See Also
glCallList, glCallLists, glDeleteLists,
glNewList


glIsList

Purpose
Tests for the existence of a display list.
Include File
<gl.h>
Syntax
GLboolean glIsList(GLuint list );
Description
This function is used to find out if a display
list exists for a given identifier. You can use this function to test
display list values before using them.


Parameters


list

GLuint: The value of a potential display list. This function tests this value to see if a display list is defined for it.
Returns
GL_TRUE if the display list exists, otherwise
GL_FALSE.


Example
The following code loops through an array that should contain valid display lists. The display list identifier is tested for validity, and if valid it is called

int lists[25]; // Array of display lists
int x; // Looping variable



for(x = 0; x < 25; x++)
if(glIsList(lists[x])
glCallList();


See Also
glCallList, glCallLists, glDeleteLists,
glGenLists, glNewList


glListBase

Purpose
Specifies an offset to be added to the list values specified in a call to glCallLists.
Include File
<gl.h>
Syntax
void glListBase(GLuint base );
Description
The function glCallLists calls a series of
display lists listed in an array. This function sets an offset value
that can be added to each display list name for this function. By
default this is zero. You can retrieve the current value by calling
glGet(GL_LIST_BASE).


Parameters


base

GLuint: Sets an integer offset value that will be added to display list names specified in calls to glCallLists. This value is zero by default.
Returns
None.


Example
The following code fragment creates 20 display lists numbered 0 through 19. An array of display list names (listA) is created that contains the numbers 0 through 9. Then glCallLists is used to execute all the display lists named in the listA array. Then, rather than reload the array with the next 10 display lists names, an offset value is specified with a call to glListBase. When glCallLists is called using the listA array, each element in listA will be offset by the value specified (10).

int listA[10];
int i;

for(i = 0; i < 10; i++)
listA[i] = i;

// Build display Lists 1 - 20
glNewList(1,GL_COMPILE);


glEndList();

// Second list
glNewList(2,GL_COMPILE);


glEndList();

// And so on

// Call first ten lists
glCallLists(10,GL_INT,listA);

// Call next ten lists, using the same array
glListBase(10);
glCallIsts(10,GL_INT,listA);


See Also
glCallLists


glNewList

Purpose
Begins the creation or replacement of a display list.
Include File
<gl.h>
Syntax
void glNewList(GLuint list, GLenum mode);
Description
A display list is a group of OpenGL commands
that are stored for execution on command. You can use display lists to
speed up drawings that are computationally intensive or that require
data to be read from a disk. The glNewList function begins a display
list with an identifier specified by the integer list parameter. The
display list identifier is used by glCallList and glCallLists to refer
to the display list. If itłs not unique, a previous display list may be
overwritten. You can use glGenLists to reserve a range of display list
names, and glIsList to test a display list identifier before using it.
Display lists can be compiled only, or compiled and executed. After
glNewList is called, all OpenGL commands are stored in the display list
in the order they were issued until glEndList is called. The following
commands are executed when called and are never stored in the display
list itself: glIsList, glGenLists, glDeleteLists, glFeedbackBuffer,
glSelectBuffer, glRenderMode, glReadPixels, glPixelStore, glFlush,
glFinish, glIsEnabled, and glGet.


Parameters


list

GLuint: The numerical name of the display list. If the display list already exists, it is replaced by the new display list.
mode

GLenum: Display lists may be compiled and executed later, or compiled and executed simultaneously. Specify GL_COMPILE to only compile the display list, or GL_COMPILE_AND_EXECUTE to execute the display list as it is being compiled.
Returns
None.


Example
The following is an example of a display list being delimited by glNewList and glEndList. This particular display list is composed by nesting two other display lists within it.

// Begin delimit of list
glNewList(BOLT_LIST,GL_COMPILE);

// Display list calls two previously defined display lists
glCallList(SHAFT_LIST);
glCallList(THREAD_LIST);

// End this display listglEndList();


See Also
glCallList, glCallLists, glDeleteLists,
glGenLists, glIsList






Previous
Table of Contents
Next














 


Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc.
All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement.












Wyszukiwarka

Podobne podstrony:
341 344
341 344
02 (344)
demo cgi 341
341 346
338 341 2kik7bqsuvg6pw2lts4uqae265zwjmklsp6fk5y
20 Diagnozowanie i naprawa układów hydraulicznychid!341
344 itsamaker
17 (344)
SIGMUND EMRING (RINGECK) 1508 E 1939 65 341
341 (2)
demo cgi 344
344 352
05 (341)

więcej podobnych podstron