A utility class containing methods related to Stage3D and rendering in general.

### Hierarchy

- RenderUtil

## Index

### Methods

- clear
- createAGALTexOperation
- getTextureLookupFlags
- getTextureVariantBits
- requestContext3D
- setSamplerStateAt

## Methods

### Static clear

- clear(rgb?: number, alpha?: number, depth?: number, stencil?: number): void

- - Defined in lib/starling/utils/RenderUtil.d.ts:15

  Clears the render context with a certain color and alpha value.

  #### Parameters

  - ##### Optional rgb: number

  - ##### Optional alpha: number

  - ##### Optional depth: number

  - ##### Optional stencil: number

  #### Returns void

### Static createAGALTexOperation

- createAGALTexOperation(resultReg: string, uvReg: string, sampler: number, texture: Texture, convertToPmaIfRequired?: boolean, tempReg?: string): string

- - Defined in lib/starling/utils/RenderUtil.d.ts:61

  Creates an AGAL source string with a `tex` operation, including an options list with the appropriate format flag.

  Note that values for `repeat/clamp`, `filter` and `mip-filter` are not included in the options list, since it's preferred to set those values at runtime via `setSamplerStateAt`.

  Starling expects every color to have its alpha value premultiplied into the RGB channels. Thus, if this method encounters a non-PMA texture, it will (per default) convert the color in the result register to PMA mode, resulting in an additional `mul`-operation.

  @param resultReg the register to write the result into. @param uvReg the register containing the texture coordinates. @param sampler the texture sampler to use. @param texture the texture that's active in the given texture sampler. @param convertToPmaIfRequired indicates if a non-PMA color should be converted to PMA. @param tempReg if 'resultReg' is the output register and PMA conversion is done, a temporary register is needed.

  @return the AGAL source code, line break(s) included.

  #### Parameters

  - ##### resultReg: string

  - ##### uvReg: string

  - ##### sampler: number

  - ##### texture: Texture

  - ##### Optional convertToPmaIfRequired: boolean

  - ##### Optional tempReg: string

  #### Returns string

### Static getTextureLookupFlags

- getTextureLookupFlags(format: string, mipMapping: boolean, repeat?: boolean, smoothing?: string): string

- - Defined in lib/starling/utils/RenderUtil.d.ts:20

  Returns the flags that are required for AGAL texture lookup, including the '<' and '>' delimiters.

  #### Parameters

  - ##### format: string

  - ##### mipMapping: boolean

  - ##### Optional repeat: boolean

  - ##### Optional smoothing: string

  #### Returns string

### Static getTextureVariantBits

- getTextureVariantBits(texture: Texture): number

- - Defined in lib/starling/utils/RenderUtil.d.ts:31

  Returns a bit field uniquely describing texture format and premultiplied alpha, so that each required AGAL variant will get its unique ID. This method is most useful when overriding the `programVariantName` method of custom effects.

  @return a bit field using the 3 least significant bits.

  #### Parameters

  - ##### texture: Texture

  #### Returns number

### Static requestContext3D

- requestContext3D(stage3D: Stage3D, renderMode: string, profile: any): void

- - Defined in lib/starling/utils/RenderUtil.d.ts:82

  Requests a context3D object from the given Stage3D object.

  #### Parameters

  - ##### stage3D: Stage3D

    The stage3D object the context needs to be requested from.

  - ##### renderMode: string

    The 'Context3DRenderMode' to use when requesting the context.

  - ##### profile: any

    If you know exactly which 'Context3DProfile' you want to use, simply pass a String with that profile.

                      <p>If you are unsure which profiles are supported on the current
                      device, you can also pass an Array of profiles; they will be
                      tried one after the other (starting at index 0), until a working
                      profile is found. If none of the given profiles is supported,
                      the Stage3D object will dispatch an ERROR event.</p>

                      <p>You can also pass the String 'auto' to use the best available
                      profile automatically. This will try all known Stage3D profiles,
                      beginning with the most powerful.</p>

  #### Returns void

### Static setSamplerStateAt

- setSamplerStateAt(sampler: number, mipMapping: boolean, smoothing?: string, repeat?: boolean): void

- - Defined in lib/starling/utils/RenderUtil.d.ts:35

  Calls `setSamplerStateAt` at the current context, converting the given parameters to their low level counterparts.

  #### Parameters

  - ##### sampler: number

  - ##### mipMapping: boolean

  - ##### Optional smoothing: string

  - ##### Optional repeat: boolean

  #### Returns void

Generated using TypeDoc