struct Gloop::Attribute

Overview

Information about a vertex attribute from the bound vertex array.

This type should be used if direct state access (DSA) isn't available.

NOTE The currently bound vertex array is always referenced. If another vertex array is bound, then this will reference the newly bound instance.

Included Modules

Defined in:

gloop/attribute.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(context : Context, index : UInt32) #

Creates the attribute reference.


[View source]

Instance Method Detail

def address : Size #

Retrieves the offset within buffer data to the first value of the attribute.

  • OpenGL function: glGetVertexAttribPointerv
  • OpenGL enum: GL_VERTEX_ATTRIB_ARRAY_POINTER
  • OpenGL version: 2.0

[View source]
def data_pointer : Pointer(Void) #

Retrieves the pointer within buffer data to the first value of the attribute.

  • OpenGL function: glGetVertexAttribPointerv
  • OpenGL enum: GL_VERTEX_ATTRIB_ARRAY_POINTER
  • OpenGL version: 2.0

[View source]
def disable : Nil #

Disables the attribute in the vertex array.

  • OpenGL function: glDisableVertexAttribArray
  • OpenGL version: 2.0

[View source]
def divisor : UInt32 #

Returns the frequency divisor for instanced rendering.

  • OpenGL function: glGetVertexAttribiv
  • OpenGL enum: GL_VERTEX_ATTRIB_ARRAY_DIVISOR
  • OpenGL version: 3.2

[View source]
def divisor=(divisor : UInt32) #

Sets the rate at which attribute values advance during instances rendering.

  • OpenGL function: glVertexAttribDivisor
  • OpenGL version: 3.2

[View source]
def enable : Nil #

Enables the attribute in the vertex array.

  • OpenGL function: glEnableVertexAttribArray
  • OpenGL version: 2.0

[View source]
def enabled? : Bool #

Indicates whether the attribute is enabled for the vertex array.

  • OpenGL function: glGetVertexAttribiv
  • OpenGL enum: GL_VERTEX_ATTRIB_ARRAY_ENABLED
  • OpenGL version: 2.0

[View source]
def float64? : Bool #

Indicates whether the attribute's data is a double-precision floating-point value on the GPU.

  • OpenGL function: glGetVertexAttribiv
  • OpenGL enum: GL_VERTEX_ATTRIB_ARRAY_LONG
  • OpenGL version: 2.0

[View source]
def format : AttributeFormat #

Retrieves all format information about the attribute.


[View source]
def format=(format : Float32AttributeFormat) #

Sets the format of the attribute.

The data will be 32-bit floating-point values on the GPU.

  • OpenGL function: glVertexAttribFormat
  • OpenGL version: 4.3

[View source]
def format=(format : IntAttributeFormat) #

Sets the format of the attribute.

The data will be integer values on the GPU.

  • OpenGL function: glVertexAttribIFormat
  • OpenGL version: 4.3

[View source]
def format=(format : Float64AttributeFormat) #

Sets the format of the attribute.

The data will be 64-bit floating-point values on the GPU.

  • OpenGL function: glVertexAttribLFormat
  • OpenGL version: 4.3

[View source]
def index : UInt32 #

Index of the attribute.


[View source]
def integer? : Bool #

Indicates whether the attribute's data is an integer on the GPU.

  • OpenGL function: glGetVertexAttribiv
  • OpenGL enum: GL_VERTEX_ATTRIB_ARRAY_INTEGER
  • OpenGL version: 2.0

[View source]
def normalized? : Bool #

Indicates whether the attribute's value is normalized when converted to a float-poing number.

  • OpenGL function: glGetVertexAttribiv
  • OpenGL enum: GL_VERTEX_ATTRIB_ARRAY_NORMALIZED
  • OpenGL version: 2.0

[View source]
def pointer : AttributePointer #

Retrieves all format information about the attribute.


[View source]
def pointer=(pointer : Float32AttributePointer) #

Specifies a pointer to attribute data.

The data will be 32-bit floating-point values on the GPU.

  • OpenGL function: glVertexAttribPointer
  • OpenGL version: 2.0

[View source]
def pointer=(pointer : IntAttributePointer) #

Specifies a pointer to attribute data.

The data will be integer values on the GPU.

  • OpenGL function: glVertexAttribIPointer
  • OpenGL version: 3.0

[View source]
def pointer=(pointer : Float64AttributePointer) #

Specifies a pointer to attribute data.

The data will be 64-bit floating-point values on the GPU.

  • OpenGL function: glVertexAttribLPointer
  • OpenGL version: 4.1

[View source]
def relative_offset : UInt32 #

Retrieves the number of bytes from the start of the vertex buffer data to the first instance of this attribute.

  • OpenGL function: glGetVertexAttribiv
  • OpenGL enum: GL_VERTEX_ATTRIB_ARRAY_RELATIVE_OFFSET
  • OpenGL version: 4.3

[View source]
def size #

Retrieves the number of components in the attribute.

  • OpenGL function: glGetVertexAttribiv
  • OpenGL enum: GL_VERTEX_ATTRIB_ARRAY_SIZE
  • OpenGL version: 2.0

[View source]
def specify_float64_format(size : Int32, relative_offset : UInt32, type : Float64AttributeFormat::Type = :float64) : Nil #

Specifies the format of the attribute.

The data will be 64-bit floating-point values on the GPU.

  • OpenGL function: glVertexAttribLFormat
  • OpenGL version: 4.3

[View source]
def specify_float64_pointer(size : Int32, stride : Int32 = 0, address : Size = 0, type : Float64AttributePointer::Type = :float64) : Nil #

Specifies a pointer to attribute data.

The data will be 64-bit floating-point values on the GPU.

  • OpenGL function: glVertexAttribLPointer
  • OpenGL version: 4.1

[View source]
def specify_format(size : Int32, type : Float32AttributeFormat::Type, normalized : Bool, relative_offset : UInt32) : Nil #

Specifies the format of the attribute.

The data will be 32-bit floating-point values on the GPU.

  • OpenGL function: glVertexAttribFormat
  • OpenGL version: 4.3

[View source]
def specify_int_format(size : Int32, type : IntAttributeFormat::Type, relative_offset : UInt32) : Nil #

Specifies the format of the attribute.

The data will be integer values on the GPU.

  • OpenGL function: glVertexAttribIFormat
  • OpenGL version: 4.3

[View source]
def specify_int_pointer(size : Int32, type : IntAttributePointer::Type, stride : Int32 = 0, address : Size = 0) : Nil #

Specifies a pointer to attribute data.

The data will be integer values on the GPU.

  • OpenGL function: glVertexAttribIPointer
  • OpenGL version: 3.0

[View source]
def specify_pointer(size : Int32, type : Float32AttributePointer::Type, normalized : Bool, stride : Int32 = 0, address : Size = 0) : Nil #

Specifies a pointer to attribute data.

The data will be 32-bit floating-point values on the GPU.

  • OpenGL function: glVertexAttribPointer
  • OpenGL version: 2.0

[View source]
def stride #

Returns the number of bytes between attribute values in the buffer data.

  • OpenGL function: glGetVertexAttribiv
  • OpenGL enum: GL_VERTEX_ATTRIB_ARRAY_STRIDE
  • OpenGL version: 2.0

[View source]

Returns the attribute's data type.

  • OpenGL function: glGetVertexAttribiv
  • OpenGL enum: GL_VERTEX_ATTRIB_ARRAY_TYPE
  • OpenGL version: 2.0

[View source]