610 613














Open GL Super Bible:Interactive Graphics















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



function isIE4()
{
return( navigator.appName.indexOf("Microsoft") != -1 && (navigator.appVersion.charAt(0)==
'4')
); }
function
bookMarkit() {varurl="http://www.itknowledge.com/PSUser/EWBookMarks.html?url="+window.location+"&isbn=0";
parent.location.href=url;
//var win = window.open(url,"myitk");
//if(!isIE4())
// win.focus();

}

 




Previous
Table of Contents
Next




glInitNames

Purpose
Initializes the name stack.
Include File
<gl.h>
Syntax
void glInitNames(void );
Description
The name stack is used to allow drawing primitives or groups of primitives, to be named with an unsigned integer when rendered in selection mode. Each time a primitive is named, its name is pushed on the names stack with glPushName, or the current name is replaced with glLoadName. This function sets the name stack to its initial condition with no names on the stack.
Returns
None.


Example
The following code is from the example program PLANETS. It initializes the names stack and places a single value on the stack.

// Initialize the names stack
glInitNames();
glPushName(0);


See Also
glInitNames, glPushName, glRenderMode,
glSelectBuffer


glLoadName

Purpose
Loads a name onto the name stack.
Include File
<gl.h>
Syntax
void glLoadName(GLuint name);
Description
This function places the name specified on the
top of the names stack. The name stack is used to name primitives or
groups of primitives when rendered in selection mode. The current name
on the names stack is actually replaced by the name specified with this
function.


Parameters

name

GLuint: Specifies the name to be placed on the names stack. Selection names are unsigned integers.
Returns
None.


Example
The following code from the PLANETS example program shows a name being loaded on the name stack just before an object is rendered.

// Set material color, Yellow
// Sun
glRGB(255, 255, 0);
glLoadName(SUN);
auxSolidSphere(15.0f);


See Also
glInitNames, glPushName, glRenderMode,
glSelectBuffer


glPassThrough

Purpose
Places a marker in the feedback buffer.
Include File
<gl.h>
Syntax
void glPassThrough(GLfloat token );
Description
When OpenGL is placed in feedback mode, no
pixels are drawn to the framebuffer.Instead, information about the
drawing primitives is placed in a feedback buffer. This function allows
you to place the token GL_PASS_THROUGH_TOKEN in the midst of the
feedback buffer, which will be followed by the floating point value
specified by this function. This function is called in your rendering
code and has no effect unless in feedback mode.


Parameters

token

GLfloat: A value to be placed in the feedback buffer following the
GL_PASS_THROUGH_TOKEN.
Returns
None.


Example
The following code from the SELECT example program demonstrates glPassThrough and glLoadName being used together to identify an object. This marks the object in both the selection and feedback buffers.

// Set material color, Yellow
// Cube
glRGB(255, 255, 0);
glLoadName(CUBE);
glPassThrough((GLfloat)CUBE);
auxSolidCube(75.0f);


See Also
glFeedbackBuffer, glRenderMode


glPopName

Purpose
Pops (removes) the top entry from the name stack.
Include File
<gl.h>
Syntax
void glPopName(void);
Description
The names stack is used during selection to identify drawing commands. This function removes a name from the top of the names stack. The current depth of the name stack can be retrieved by calling glGet with GL_NAME_STACK_DEPTH.
Returns
None.


Example
The following code from the MOONS example program uses the name stack to place the name of a planet and its moon on the name stack for selection. This code in particular shows one moonłs name being popped off the name stack before the name of the next moon is pushed on.

// Draw Mars
glRGB(255,0,0);
glPushMatrix();
glTranslatef(100.0f, 0.0f, 0.0f);
glLoadName(MARS);
auxSolidSphere(20.0f);

// Draw Moon1
glTranslatef(-40.0f, 40.0f, 0.0f);
glRGB(220,220,220);
glPushName(MOON1);
auxSolidSphere(5.0f);
glPopName();

// Draw Moon2
glTranslatef(0.0f, -80.0f, 0.0f);
glPushName(MOON2);
auxSolidSphere(5.0f);
glPopName();
glPopMatrix();


See Also
glInitNames, glLoadName, glRenderMode,
glSelectBuffer, glPushName


glPushName

Purpose
Specifies a name that will be pushed on the name stack.
Include File
<gl.h>
Syntax
void glPushName(GLuint name);
Description
The names stack is used during selection to
identify drawing commands. This function pushes a name on the names
stack to identify any subsequent drawing commands. The names stack
maximum depth can be retrieved by calling glGet with
GL_MAX_NAME_STACK_DEPTH, and the current depth by calling glGet with
GL_NAME_STACK_DEPTH. The maximum depth of the names stack can vary with
implementation, but all implementations must support at least 64
entries.


Parameters

name

GLuint: The name to be pushed onto the names stack.
Returns
None.


Example
The following code from the MOONS example program uses the name stack to place the name of a planet and its moon on the name stack for selection. This code in particular shows the names of the moons being pushed on the names stack after the name of the planet. This moonłs name is then popped off before the next moonłs name is pushed on.

// Draw Mars
glRGB(255,0,0);
glPushMatrix();
glTranslatef(100.0f, 0.0f, 0.0f);
glLoadName(MARS);
auxSolidSphere(20.0f);

// Draw Moon1
glTranslatef(-40.0f, 40.0f, 0.0f);
glRGB(220,220,220);
glPushName(MOON1);
auxSolidSphere(5.0f);
glPopName();

// Draw Moon2
glTranslatef(0.0f, -80.0f, 0.0f);
glPushName(MOON2);
auxSolidSphere(5.0f);
glPopName();
glPopMatrix();


See Also
glInitNames, glLoadName, glRenderMode,
glSelectBuffer, glPopName






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:
M Audio ProFire 610 Nowa Odsłona
610 Elementy składowe rocznego sprawozdania finasowego
613,17,artykul
613 (2)
613 PRAW
Dz U 2010 nr 65 poz 613
609 613
613!
KODA GOKY DRA 610 AM 995
613 614
607 610

więcej podobnych podstron