gem install ashton --pre
Window#flush
, but that will flush _everything_ that is pending not just the items in a block (or, in the case of the :shader option I've added to Image#draw
et al, to individual items). Is there a way to do this now, or can it be added, either on individual #draw
s or in some sort of Gosu#draw_immediate = true/false
option?
Image#draw_points points_array, z, etc
would be worth implementing (using point sprites). I suspect that could be a lot faster than a lot of individual draws if you have a lot of moving particles, but I'm worried that the cost in particle systems is more about the Ruby code managing them than anything else.Window#draw_line
.
GL_LINE
was a total disaster because it turned out to work differently on every driver and only caused confusion and bug reports. I wouldn't trust GL_POINT
to work any better. A wasteful quad per particle should be fine, everything else seems to be good for debug UI only. :(record
uses a vertex array but doesn't let you change the positions afterwards, mostly because I haven't figured out a nice interface to do so. Of course the particle engine could use its own gl(z) {}
block to render everything with an optimized vertex array. Then I also don't know if there is an issue with keeping the VA in VRAM vs. system RAM.vx
to x
and ax
to vx
etc. - I don't think a wrapping a library for that is worth the hassle :)
gl(z)
should not break with shaders, I thought the crash was related to calling Image#draw
inside the block :S Can you please open a ticket on github with the code attached?for
loop. It wouldn't even have to be deeply tied to Gosu if it used a vertex array.
Window#render_to_texture
, drawing white circular images into a black image, then image.clear dest_select :white
to make the white bits into "holes" ( render_to_texture uses the screen as a buffer, so only works in RGB). You may have had to increase the pixel size of the lighting though, to get it fast enough, but that is rather moot now, I hope!initialize': undefined method
version_supported?' for GL:Module (NoMethodError)initialize'
from C:/Ruby/lib/ruby/gems/1.9.1/gems/ashton-0.0.1alpha/examples/shader_image_example.rb:21:in
new'initialize'
from C:/Ruby/lib/ruby/gems/1.9.1/gems/ashton-0.0.1alpha/examples/shader_image_example.rb:41:in
new'bundle exec ruby examples/shader_image_example.rb
undefined method 'version_supported?' for GL:Module
error.D:\rubydev\gosu\ashton>bundle exec ruby examples/shader_image_example.rb
D:/rubydev/gosu/ashton/lib/ashton/shader.rb:309:in 'link': Shader link error: Fragment info (Ashton::ShaderLinkError)
-------------
(14) : error C5051: profile does not support conditional returns
from D:/rubydev/gosu/ashton/lib/ashton/shader.rb:56:in 'initialize'
from examples/shader_image_example.rb:24:in 'new'
from examples/shader_image_example.rb:24:in 'initialize'
from examples/shader_image_example.rb:74:in 'new'
from examples/shader_image_example.rb:74:in '<main>'
D:\rubydev\gosu\ashton>bundle exec ruby examples\framebuffer_example.rb
*** Runs great! No errors and a constant 59/60fps! ***
D:\rubydev\gosu\ashton>examples\framebuffer_example.rb
D:/rubydev/gosu/ashton/lib/ashton/framebuffer.rb:167:in 'create_framebuffer': undefined method 'glGenFramebuffersEXT' for #<Ashton::Framebuffer:0xe88450 @height=600, @width=800> (NoMethodError)
from D:/rubydev/gosu/ashton/lib/ashton/framebuffer.rb:9:in 'initialize'
from D:/rubydev/gosu/ashton/examples/framebuffer_example.rb:20:in 'new'
from D:/rubydev/gosu/ashton/examples/framebuffer_example.rb:20:in 'initialize'
from D:/rubydev/gosu/ashton/examples/framebuffer_example.rb:51:in 'new'
from D:/rubydev/gosu/ashton/examples/framebuffer_example.rb:51:in '<main>'
D:\rubydev\gosu\ashton>cd c:\Ruby\lib\ruby\gems\1.9.1\gems\ashton-0.0.1alpha\examples
C:\Ruby\lib\ruby\gems\1.9.1\gems\ashton-0.0.1alpha\examples>framebuffer_example.rb
C:/Ruby/lib/ruby/gems/1.9.1/gems/ashton-0.0.1alpha/lib/ashton/framebuffer.rb:143:in 'init_framebuffer': undefined method 'glGenFramebuffersEXT' for #<Ashton::Framebuffer:0xe98770 @height=600, @width=800> (NoMethodError)
from C:/Ruby/lib/ruby/gems/1.9.1/gems/ashton-0.0.1alpha/lib/ashton/framebuffer.rb:21:in 'initialize'
from C:/Ruby/lib/ruby/gems/1.9.1/gems/ashton-0.0.1alpha/examples/framebuffer_example.rb:20:in 'new'
from C:/Ruby/lib/ruby/gems/1.9.1/gems/ashton-0.0.1alpha/examples/framebuffer_example.rb:20:in 'initialize'
from C:/Ruby/lib/ruby/gems/1.9.1/gems/ashton-0.0.1alpha/examples/framebuffer_example.rb:49:in 'new'
from C:/Ruby/lib/ruby/gems/1.9.1/gems/ashton-0.0.1alpha/examples/framebuffer_example.rb:49:in '<main>'
c:/Ruby/lib/ruby/gems/1.9.1/gems/ashton-0.0.1alpha/lib/ashton/base_shader.rb:34:in 'glBindFragDataLocationEXT': Extension GL_EXT_gpu_shader4 is not available on this system (NotImplementedError)
return
apparently isn't supported in GLSL1.10 (OpenGL2.0), so I refactored the code to remove them. Problem is I have no idea what other gotchas will jump on me as I make more code.Ashton::Lighting::LightSource
and Ashton::Lighting::Manager
. Sadly, this doesn't work without glitches yet, but it is based on someone else's shader/XNA code and should eventually look like: http://www.youtube.com/watch?v=m0-VW0N57ss
Framebuffer#[x, y] #=> Get colour (Gosu::Color, which is more Gosu-friendly than Texplay's RGBA float array) from a framebuffer texture
Framebuffer#transparent?(x, y) #=> true if the colour is entirely transparent. Useful for pixel-perfect collision detection.
Framebuffer#refresh_cache #=> Reload the texture data from the graphics card (for example if the framebuffer has been draw to in a #render block).
Framebuffer#refresh_cache 0.204000 0.110000 0.314000 ( 0.161133)
Framebuffer#[] 0.046000 0.000000 0.046000 ( 0.045898)
Framebuffer#transparent? 0.000000 0.000000 0.000000 ( 0.000977)
TexPlay equivalents
Image#refresh_cache 1.079000 0.453000 1.532000 ( 0.780274)
Image#[] 0.078000 0.000000 0.078000 ( 0.083984)
Image#[][3] == 0.0 0.109000 0.000000 0.109000 ( 0.113281)
Framebuffer#rgba
(returns array of Fixnum) and Framebuffer#red/green/blue/alpha
. This allows you to get the colour information exactly as efficiently as you require (this will be useful to me for reading data from images processed by shaders).
# The frames of animation for your character. Might want to dup them so that you keep copies of all the different colour schemes after creating them.
@frames.each do |frame|
# Hash of { old_color => new_color }
@color_replacements.each_pair do |old_color, new_color|
frame.clear :color => new_color, :dest_select => old_color, :tolerance => 0.001
end
end
Ashton::Framebuffer
as Ashton::Texture
since it is a texture with a framebuffer, not a framebuffer with a texture. If I can, I'll add a framebuffer-based #render
to Gosu::Image
too.Ashton::SignedDistanceField
, which is an absolutely wonderful system to detect collisions against static scenery, lines of sight and many more wonderful things.
Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill