---
name: "glConvolutionFilter1D"
section: "3x"
platform: "linux"
package: "xlibmesa-gl-dev"
version: "4.3.0.dfsg.1-14sarge7"
release: "Debian 3.1 (Sarge)"
platforms: ["linux"]
url: "https://new.carta.tech/glConvolutionFilter1D"
---

# glConvolutionFilter1D(3x)

define a one-dimensional convolution filter

## NAME

**glConvolutionFilter1D** - define a one-dimensional convolution filter

## C SPECIFICATION

void **glConvolutionFilter1D**( GLenum *target*,

```
	GLenum internalformat,
	GLsizei width,
	GLenum format,
	GLenum type,
	const GLvoid *image )
```

## PARAMETERS

- *target*

  Must be **GL\_CONVOLUTION\_1D**.

- *internalformat*

  The internal  of the convolution filter kernel. The allowable values are **GL\_ALPHA**, **GL\_LUMINANCE**, **GL\_LUMINANCE\_ALPHA**, **GL\_INTENSITY**, **GL\_RGB**, and **GL\_RGBA**.

- *width*

  The width of the pixel array referenced by *image*.

- *format*

  The  of the pixel data in *image*. The allowable values are **GL\_ALPHA**, **GL\_ALPHA4**, **GL\_ALPHA8**, **GL\_ALPHA12**, **GL\_ALPHA16**, **GL\_LUMINANCE**, **GL\_LUMINANCE4**, **GL\_LUMINANCE8**, **GL\_LUMINANCE12**, **GL\_LUMINANCE16**, **GL\_LUMINANCE\_ALPHA**, **GL\_LUMINANCE4\_ALPHA4**, **GL\_LUMINANCE6\_ALPHA2**, **GL\_LUMINANCE8\_ALPHA8**, **GL\_LUMINANCE12\_ALPHA4**, **GL\_LUMINANCE12\_ALPHA12**, **GL\_LUMINANCE16\_ALPHA16**, **GL\_INTENSITY**, **GL\_INTENSITY4**, **GL\_INTENSITY8**, **GL\_INTENSITY12**, **GL\_INTENSITY16**, **GL\_R3\_G3\_B2**, **GL\_RGB**, **GL\_RGB4**, **GL\_RGB5**, **GL\_RGB8**, **GL\_RGB10**, **GL\_RGB12**, **GL\_RGB16**, **GL\_RGBA**, **GL\_RGBA2**, **GL\_RGBA4**, **GL\_RGB5\_A1**, **GL\_RGBA8**, **GL\_RGB10\_A2**, **GL\_RGBA12**, or **GL\_RGBA16**.

- *type*

  The type of the pixel data in *image*. Symbolic constants **GL\_UNSIGNED\_BYTE**, **GL\_BYTE**, **GL\_BITMAP**, **GL\_UNSIGNED\_SHORT**, **GL\_SHORT**, **GL\_UNSIGNED\_INT**, **GL\_INT**, **GL\_FLOAT**, **GL\_UNSIGNED\_BYTE\_3\_3\_2**, **GL\_UNSIGNED\_BYTE\_2\_3\_3\_REV**, **GL\_UNSIGNED\_SHORT\_5\_6\_5**, **GL\_UNSIGNED\_SHORT\_5\_6\_5\_REV**, **GL\_UNSIGNED\_SHORT\_4\_4\_4\_4**, **GL\_UNSIGNED\_SHORT\_4\_4\_4\_4\_REV**, **GL\_UNSIGNED\_SHORT\_5\_5\_5\_1**, **GL\_UNSIGNED\_SHORT\_1\_5\_5\_5\_REV**, **GL\_UNSIGNED\_INT\_8\_8\_8\_8**, **GL\_UNSIGNED\_INT\_8\_8\_8\_8\_REV**, **GL\_UNSIGNED\_INT\_10\_10\_10\_2**, and **GL\_UNSIGNED\_INT\_2\_10\_10\_10\_REV** are accepted.

- *image*

  Pointer to a one-dimensional array of pixel data that is processed to build the convolution filter kernel.

## DESCRIPTION

**glConvolutionFilter1D** builds a one-dimensional convolution filter kernel from an array of pixels.

The pixel array specified by *width*, *format*, *type*, and *image* is extracted from memory and processed just as if **glDrawPixels** were called, but processing stops after the final expansion to RGBA is completed.

The R, G, B, and A components of each pixel are next scaled by the four 1D **GL\_CONVOLUTION\_FILTER\_SCALE** parameters and biased by the four 1D **GL\_CONVOLUTION\_FILTER\_BIAS** parameters. (The scale and bias parameters are set by **glConvolutionParameter** using the **GL\_CONVOLUTION\_1D** target and the names **GL\_CONVOLUTION\_FILTER\_SCALE** and **GL\_CONVOLUTION\_FILTER\_BIAS**. The parameters themselves are vectors of four values that are applied to red, green, blue, and alpha, in that order.) The R, G, B, and A values are not clamped to \[0,1\] at any time during this process.

Each pixel is then converted to the internal  specified by *internalformat*. This conversion simply maps the component values of the pixel (R, G, B, and A) to the values included in the internal  (red, green, blue, alpha, luminance, and intensity).  The mapping is as follows:

| | | | | | | |
| --- | --- | --- | --- | --- | --- | --- |
| **Internal Format** | **Red** | **Green** | **Blue** | **Alpha** | **Luminance** | **Intensity** |
| **GL\_ALPHA** |  |  |  | A |
| **GL\_LUMINANCE** |  |  |  | R |
| **GL\_LUMINANCE\_ALPHA** |  |  | A | R |
| **GL\_INTENSITY** |  |  |  |  |  | R |
| **GL\_RGB** | R | G | B |
| **GL\_RGBA** | R | G | B | A |

The red, green, blue, alpha, luminance, and/or intensity components of the resulting pixels are stored in floating-point rather than integer They form a one-dimensional filter kernel image indexed with coordinate *i* such that *i* starts at 0 and increases from left to right. Kernel location *i* is derived from the *i*th pixel, counting from 0.

Note that after a convolution is performed, the resulting color components are also scaled by their corresponding **GL\_POST\_CONVOLUTION\_c\_SCALE** parameters and biased by their corresponding **GL\_POST\_CONVOLUTION\_c\_BIAS** parameters (where *c* takes on the values **RED**, **GREEN**, **BLUE**, and **ALPHA**). These parameters are set by **glPixelTransfer**.

## NOTES

**glConvolutionFilter1D** is present only if **GL\_ARB\_imaging** is returned when **glGetString** is called with an argument of **GL\_EXTENSIONS**.

## ERRORS

**GL\_INVALID\_ENUM** is generated if *target* is not **GL\_CONVOLUTION\_1D**.

**GL\_INVALID\_ENUM** is generated if *internalformat* is not one of the allowable values.

**GL\_INVALID\_VALUE** is generated if *width* is less than zero or greater than the maximum supported value. This value may be queried with **glGetConvolutionParameter** using target **GL\_CONVOLUTION\_1D** and name **GL\_MAX\_CONVOLUTION\_WIDTH**.

**GL\_INVALID\_ENUM** is generated if *format* is not one of the allowable values.

**GL\_INVALID\_ENUM** is generated if *type* is not one of the allowable values.

**GL\_INVALID\_OPERATION** is generated if **glConvolutionFilter1D** is executed between the execution of **glBegin** and the corresponding execution of **glEnd**.

**GL\_INVALID\_OPERATION** is generated if *format* is one of **GL\_UNSIGNED\_BYTE\_3\_3\_2**, **GL\_UNSIGNED\_BYTE\_2\_3\_3\_REV**, **GL\_UNSIGNED\_SHORT\_5\_6\_5**, or **GL\_UNSIGNED\_SHORT\_5\_6\_5\_REV** and *type* is not **GL\_RGB**.

**GL\_INVALID\_OPERATION** is generated if *format* is one of **GL\_UNSIGNED\_SHORT\_4\_4\_4\_4**, **GL\_UNSIGNED\_SHORT\_4\_4\_4\_4\_REV**, **GL\_UNSIGNED\_SHORT\_5\_5\_5\_1**, **GL\_UNSIGNED\_SHORT\_1\_5\_5\_5\_REV**, **GL\_UNSIGNED\_INT\_8\_8\_8\_8**, **GL\_UNSIGNED\_INT\_8\_8\_8\_8\_REV**, **GL\_UNSIGNED\_INT\_10\_10\_10\_2**, or **GL\_UNSIGNED\_INT\_2\_10\_10\_10\_REV** and *type* is neither **GL\_RGBA** nor **GL\_BGRA**.

## ASSOCIATED GETS

**glGetConvolutionParameter**, **glGetConvolutionFilter**

## SEE ALSO

**glConvolutionFilter2D(3G)**, **glSeparableFilter2D(3G)**, **glConvolutionParameter(3G)**, **glPixelTransfer(3G)**
