Class: Ashton::WindowBuffer

Inherits:
Texture
  • Object
show all
Defined in:
lib/ashton/window_buffer.rb

Overview

A texture that is the same size as the Gosu::Window.

Constant Summary

Constants inherited from Texture

Texture::DEFAULT_DRAW_COLOR, Texture::VALID_DRAW_MODES

Instance Method Summary collapse

Methods inherited from Texture

#clear, #dup, pixelated?, #render, #rendering?, #to_image

Methods included from Mixins::VersionChecking

#check_opengl_extension, #check_opengl_version

Constructor Details

#initializeWindowBuffer

Returns a new instance of WindowBuffer.



4
5
6
# File 'lib/ashton/window_buffer.rb', line 4

def initialize
  super $window.width, $window.height
end

Instance Method Details

#captureObject

Copy the window contents into the buffer.



10
11
12
13
14
# File 'lib/ashton/window_buffer.rb', line 10

def capture
  Gl.glBindTexture Gl::GL_TEXTURE_2D, id
  Gl.glCopyTexImage2D Gl::GL_TEXTURE_2D, 0, Gl::GL_RGBA8, 0, 0, width, height, 0
  self
end