Class: Engine::Metal::ComputeTexture
- Inherits:
-
Object
- Object
- Engine::Metal::ComputeTexture
- Includes:
- Fiddle
- Defined in:
- lib/engine/metal/compute_texture.rb
Constant Summary collapse
- IOSURFACE_WIDTH =
IOSurface property keys
'IOSurfaceWidth'- IOSURFACE_HEIGHT =
'IOSurfaceHeight'- IOSURFACE_BYTES_PER_ELEMENT =
'IOSurfaceBytesPerElement'- IOSURFACE_BYTES_PER_ROW =
'IOSurfaceBytesPerRow'- IOSURFACE_ALLOC_SIZE =
'IOSurfaceAllocSize'- IOSURFACE_PIXEL_FORMAT =
'IOSurfacePixelFormat'- PIXEL_FORMAT_RGBA32F =
Pixel format for RGBA32F
0x52474241
Instance Attribute Summary collapse
-
#gl_texture ⇒ Object
readonly
Returns the value of attribute gl_texture.
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#metal_texture ⇒ Object
readonly
Returns the value of attribute metal_texture.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Instance Method Summary collapse
-
#initialize(width, height) ⇒ ComputeTexture
constructor
‘RGBA’ as 32-bit int.
- #sync ⇒ Object
Constructor Details
#initialize(width, height) ⇒ ComputeTexture
‘RGBA’ as 32-bit int
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/engine/metal/compute_texture.rb', line 24 def initialize(width, height) @width = width @height = height @device = Device.instance create_iosurface create_gl_rect_texture create_gl_2d_texture setup_blit_fbo end |
Instance Attribute Details
#gl_texture ⇒ Object (readonly)
Returns the value of attribute gl_texture.
11 12 13 |
# File 'lib/engine/metal/compute_texture.rb', line 11 def gl_texture @gl_texture end |
#height ⇒ Object (readonly)
Returns the value of attribute height.
11 12 13 |
# File 'lib/engine/metal/compute_texture.rb', line 11 def height @height end |
#metal_texture ⇒ Object (readonly)
Returns the value of attribute metal_texture.
11 12 13 |
# File 'lib/engine/metal/compute_texture.rb', line 11 def end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
11 12 13 |
# File 'lib/engine/metal/compute_texture.rb', line 11 def width @width end |
Instance Method Details
#sync ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/engine/metal/compute_texture.rb', line 36 def sync Engine::GL.BindFramebuffer(Engine::GL::READ_FRAMEBUFFER, @read_fbo) Engine::GL.BindFramebuffer(Engine::GL::DRAW_FRAMEBUFFER, @draw_fbo) Engine::GL.BlitFramebuffer( 0, 0, @width, @height, 0, 0, @width, @height, Engine::GL::COLOR_BUFFER_BIT, Engine::GL::NEAREST ) Engine::GL.BindFramebuffer(Engine::GL::FRAMEBUFFER, 0) Engine::GL.Finish end |