天天看点

OpenGL开始了!

void

glLineStipple

(

GLint   factor,
GLushort   pattern

)

;

指定线的网点格局。

Description

Line stippling masks out certain fragments produced by rasterization; those fragments will not be drawn. The masking is achieved by using three parameters: the 16-bit line stipple pattern

pattern

, the repeat count

factor

, and an integer stipple counter s .

Counter s is reset to 0 whenever glBegin is called and before each line segment of a glBegin(

GL_LINES

)/glEnd sequence is generated. It is incremented after each fragment of a unit width aliased line segment is generated or after each i fragments of an i width line segment are generated. The i fragments associated with count s are masked out if

pattern

bit s factor % 16

is 0, otherwise these fragments are sent to the frame buffer. Bit zero of

pattern

is the least significant bit.

Antialiased lines are treated as a sequence of 1 × width rectangles for purposes of stippling. Whether rectangle s is rasterized or not depends on the fragment rule described for aliased lines, counting rectangles rather than groups of fragments.

To enable and disable line stippling, call glEnable and glDisable with argument

GL_LINE_STIPPLE

. When enabled, the line stipple pattern is applied as described above. When disabled, it is as if the pattern were all 1's. Initially, line stippling is disabled.

Errors

GL_INVALID_OPERATION

is generated if

glLineStipple

is executed between the execution of glBegin and the corresponding execution of glEnd.

void glutPostRedisplay(void);

导致显示图像的函数重新调用!

Description

Mark the normal plane of current window as needing to be redisplayed. The next iteration through glutMainLoop, the window's display callback will be called to redisplay the window's normal plane. Multiple calls to glutPostRedisplay before the next display callback opportunity generates only a single redisplay callback. glutPostRedisplay may be called within a window's display or overlay display callback to re-mark that window for redisplay.

Logically, normal plane damage notification for a window is treated as a glutPostRedisplay on the damaged window. Unlike damage reported by the window system, glutPostRedisplay will not set to true the normal plane's damaged status (returned by glutLayerGet(GLUT_NORMAL_DAMAGED).

Also, see glutPostOverlayRedisplay.

void

glLoadIdentity

(

void

)

;

指定用单位矩阵取代当前矩阵。

Description

glLoadIdentity

replaces the current matrix with the identity matrix. It is semantically equivalent to calling glLoadMatrix with the identity matrix

1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1

but in some cases it is more efficient.

Errors

GL_INVALID_OPERATION

is generated if

glLoadIdentity

is executed between the execution of glBegin and the corresponding execution of glEnd.

Associated Gets

glGet with argument

GL_MATRIX_MODE

glGet with argument

GL_COLOR_MATRIX

glGet with argument

GL_MODELVIEW_MATRIX

glGet with argument

GL_PROJECTION_MATRIX

glGet with argument

GL_TEXTURE_MATRIX

void

glMatrixMode

(

GLenum   mode

)

;

指定当前矩阵。

mode

Specifies which matrix stack is the target for subsequent matrix operations. Three values are accepted:

GL_MODELVIEW

,

GL_PROJECTION

, and

GL_TEXTURE

. The initial value is

GL_MODELVIEW

. Additionally, if the

ARB_imaging

extension is supported,

GL_COLOR

is also accepted.

Description

glMatrixMode

sets the current matrix mode.

mode

can assume one of four values:

GL_MODELVIEW

Applies subsequent matrix operations to the modelview matrix stack.

GL_PROJECTION

Applies subsequent matrix operations to the projection matrix stack.

GL_TEXTURE

Applies subsequent matrix operations to the texture matrix stack.

GL_COLOR

Applies subsequent matrix operations to the color matrix stack.
To find out which matrix stack is currently the target of all matrix operations, call glGet with argument

GL_MATRIX_MODE

. The initial value is

GL_MODELVIEW

.

Errors

GL_INVALID_ENUM

is generated if

mode

is not an accepted value.

GL_INVALID_OPERATION

is generated if

glMatrixMode

is executed between the execution of glBegin and the corresponding execution of glEnd.

Associated Gets

glGet with argument

GL_MATRIX_MODE

int glutCreateWindow(char *name);

创建一个顶层窗口!

void glutInitWindowSize(int width, int height);

void glutInitWindowPosition(int x, int y);

width
Width in pixels.
height
Height in pixels.
x
Window X location in pixels.
y
Window Y location in pixels.
Description

Windows created by glutCreateWindow will be requested to be created with the current initial window position and size.

The initial value of the initial window position GLUT state is -1 and -1. If either the X or Y component to the initial window position is negative, the actual window position is left to the window system to determine. The initial value of the initial window size GLUT state is 300 by 300. The initial window size components must be greater than zero.

The intent of the initial window position and size values is to provide a suggestion to the window system for a window's initial size and position. The window system is not obligated to use this information. Therefore, GLUT programs should not assume the window was created at the specified size or position. A GLUT program should use the window's reshape callback to determine the true size of the window.

void glutInitDisplayMode(unsigned int mode);

设置初始显示模式;

mode
Display mode, normally the bitwise OR-ing of GLUT display mode bit masks. See values below:
GLUT_RGBA
Bit mask to select an RGBA mode window. This is the default if neither GLUT_RGBA nor GLUT_INDEX are specified.
GLUT_RGB
An alias for GLUT_RGBA.
GLUT_INDEX
Bit mask to select a color index mode window. This overrides GLUT_RGBA if it is also specified.
GLUT_SINGLE
Bit mask to select a single buffered window. This is the default if neither GLUT_DOUBLE or GLUT_SINGLE are specified.
GLUT_DOUBLE
Bit mask to select a double buffered window. This overrides GLUT_SINGLE if it is also specified.
GLUT_ACCUM
Bit mask to select a window with an accumulation buffer.
GLUT_ALPHA
Bit mask to select a window with an alpha component to the color buffer(s).
GLUT_DEPTH
Bit mask to select a window with a depth buffer.
GLUT_STENCIL
Bit mask to select a window with a stencil buffer.
GLUT_MULTISAMPLE
Bit mask to select a window with multisampling support. If multisampling is not available, a non-multisampling window will automatically be chosen. Note: both the OpenGL client-side and server-side implementations must support the GLX_SAMPLE_SGIS extension for multisampling to be available.
GLUT_STEREO
Bit mask to select a stereo window.
GLUT_LUMINANCE
Bit mask to select a window with a ``luminance'' color model. This model provides the functionality of OpenGL's RGBA color model, but the green and blue components are not maintained in the frame buffer. Instead each pixel's red component is converted to an index between zero and glutGet(GLUT_WINDOW_COLORMAP_SIZE)-1 and looked up in a per-window color map to determine the color of pixels within the window. The initial colormap of GLUT_LUMINANCE windows is initialized to be a linear gray ramp, but can be modified with GLUT's colormap routines.

void glutInit(int *argcp, char **argv);

用于初始话GLUT库

argcp

A pointer to the program's unmodified argc variable from main.Upon return, the value pointed to by argcp will be updated, because glutInit extracts any command line options intended for the GLUT library.

argv

The program's unmodified argv variable from main. Like argcp, the data for argv will be updated because glutInit extracts any command line options understood by the GLUT library.
Description glutInit will initialize the GLUT library and negotiate a session with the window system. During this process, glutInit may cause the termination of the GLUT program with an error message to the user if GLUT cannot be properly initialized. Examples of this situation include the failure to connect to the window system, the lack of window system support for OpenGL, and invalid command line options.