/ comp / gb.opengl / gl / rendermode
Gl.RenderMode (gb.opengl)
Syntax

    STATIC FUNCTION RenderMode ( Mode AS Integer ) AS Integer

### Set rasterization mode

#### Parameters

- Mode specifies the rasterization mode. Three values are accepted: Gl.GL_RENDER, Gl.GL_SELECT, and Gl.GL_FEEDBACK. The default value is Gl.GL_RENDER.

#### Description

Gl.RenderMode sets the rasterization mode. It takes one argument, mode, which can assume one of three predefined values:

- Gl.GL_RENDER render mode. Primitives are rasterized, producing pixel fragments, which are written into the frame buffer. This is the normal mode and also the default mode.

- Gl.GL_SELECT selection mode. No pixel fragments are produced, and no change to the frame buffer contents is made. Instead, a record of the names of primitives that would have been drawn if the render mode was Gl.GL_RENDER is returned in a select buffer, which must be created (see Gl.SelectBuffer) before selection mode is entered.

- Gl.GL_FEEDBACK feedback mode. No pixel fragments are produced, and no change to the frame buffer contents is made. Instead, the coordinates and attributes of vertices that would have been drawn had the render mode been Gl.GL_RENDER is returned in a feedback buffer, which must be created (see Gl.FeedbackBuffer) before feedback mode is entered.

The return value of Gl.RenderMode is determined by the render mode at the time Gl.RenderMode is called, rather than by mode. The values returned for the three render modes are as follows:

- Gl.GL_RENDER zero.

- Gl.GL_SELECT the number of hit records transferred to the select buffer.

- Gl.GL_FEEDBACK the number of values (not vertices) transferred to the feedback buffer.

Refer to the Gl.SelectBuffer and Gl.FeedbackBuffer reference pages for more details concerning selection and feedback operation.

| If an error is generated, Gl.RenderMode returns zero regardless of the current render mode.

#### Errors

Gl.GL_INVALID_ENUM is generated if mode is not one of the three accepted values.
Gl.GL_INVALID_OPERATION is generated if Gl.SelectBuffer is called while the render mode is Gl.GL_SELECT, or if Gl.RenderMode is called with argument Gl.GL_SELECT before Gl.SelectBuffer is called at least once.
Gl.GL_INVALID_OPERATION is generated if Gl.FeedbackBuffer is called while the render mode is Gl.GL_FEEDBACK, or if Gl.RenderMode is called with argument Gl.GL_FEEDBACK before Gl.FeedbackBuffer is called at least once.
Gl.GL_INVALID_OPERATION is generated if Gl.RenderMode is called between a call to Gl.Begin and the corresponding call to Gl.End.

#### Associated Gets

Gl.GetRenderMode

### See also

Gl.FeedbackBuffer, Gl.InitNames, Gl.LoadName, Gl.PassThrough, Gl.PushName, Gl.SelectBuffer