struct Gloop::VertexArray::Attribute

Overview

Information about a vertex attribute from a vertex array.

This type uses direct state access (DSA). Ensure the OpenGL context supports this functionality prior to use.

Included Modules

Defined in:

gloop/vertex_array/attribute.cr

Constructors

Instance Method Summary

Constructor Detail

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

Creates the attribute reference.


[View source]

Instance Method Detail

def disable : Nil #

Disables the attribute in the vertex array.

  • OpenGL function: glDisableVertexArrayAttrib
  • OpenGL version: 4.5

[View source]
def divisor : UInt32 #

Returns the frequency divisor for instanced rendering.

  • OpenGL function: glGetVertexArrayIndexediv
  • OpenGL enum: GL_VERTEX_ATTRIB_ARRAY_DIVISOR
  • OpenGL version: 4.5

[View source]
def enable : Nil #

Enables the attribute in the vertex array.

  • OpenGL function: glEnableVertexArrayAttrib
  • OpenGL version: 4.5

[View source]
def enabled? : Bool #

Indicates whether the attribute is enabled for the vertex array.

  • OpenGL function: glGetVertexArrayIndexediv
  • OpenGL enum: GL_VERTEX_ATTRIB_ARRAY_ENABLED
  • OpenGL version: 4.5

[View source]
def float64? : Bool #

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

  • OpenGL function: glGetVertexArrayIndexediv
  • OpenGL enum: GL_VERTEX_ATTRIB_ARRAY_LONG
  • OpenGL version: 4.5

[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: glVertexArrayAttribFormat
  • OpenGL version: 4.5

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

Sets the format of the attribute.

The data will be integer values on the GPU.

  • OpenGL function: glVertexArrayAttribIFormat
  • OpenGL version: 4.5

[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: glVertexArrayAttribLFormat
  • OpenGL version: 4.5

[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: glGetVertexArrayIndexediv
  • OpenGL enum: GL_VERTEX_ATTRIB_ARRAY_INTEGER
  • OpenGL version: 4.5

[View source]
def normalized? : Bool #

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

  • OpenGL function: glGetVertexArrayIndexediv
  • OpenGL enum: GL_VERTEX_ATTRIB_ARRAY_NORMALIZED
  • OpenGL version: 4.5

[View source]
def offset : Int64 #

Retrieves the offset to the first value of this attribute in the currently bound array buffer.

  • OpenGL function: glGetVertexArrayIndexed64iv
  • OpenGL enum: GL_VERTEX_BINDING_OFFSET
  • OpenGL version: 4.5

[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: glGetVertexArrayIndexediv
  • OpenGL enum: GL_VERTEX_ATTRIB_ARRAY_RELATIVE_OFFSET
  • OpenGL version: 4.5

[View source]
def size #

Retrieves the number of components in the attribute.

  • OpenGL function: glGetVertexArrayIndexediv
  • OpenGL enum: GL_VERTEX_ATTRIB_ARRAY_SIZE
  • OpenGL version: 4.5

[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: glVertexArrayAttribLFormat
  • OpenGL version: 4.5

[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: glVertexArrayAttribFormat
  • OpenGL version: 4.5

[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: glVertexArrayAttribIFormat
  • OpenGL version: 4.5

[View source]
def stride #

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

  • OpenGL function: glGetVertexArrayIndexediv
  • OpenGL enum: GL_VERTEX_ATTRIB_ARRAY_STRIDE
  • OpenGL version: 4.5

[View source]

Returns the attribute's data type.

  • OpenGL function: glGetVertexArrayIndexediv
  • OpenGL enum: GL_VERTEX_ATTRIB_ARRAY_TYPE
  • OpenGL version: 4.5

[View source]