Not logged inGosu Forums
Forum back to Help Search Register Login
Up Topic Gosu / Extending Gosu / Ashton causes window to go blank
- - By RunnerPack Date 2015-03-08 18:49 Edited 2015-03-08 19:33
Hi, Spooner, (or anyone willing to take a look)

I have a problem with Ashton, and I wonder if you could shed some light, when you get a chance.

I'll preface this by saying that Ashton seems to work fine on my system; the examples all display perfectly, and even other things I've made work, up to now... This leads me to believe I'm just doing something silly, but I cannot find out what that is! I've even looked through Ashton's code to see what might be happening, to no avail.

Here's the gist: (Note: the comment explains what I'm trying to do.)

Any insight you can offer will be greatly appreciated.
Parent - - By arrow Date 2015-03-09 17:35
I had an idea that it didn't work because the draw_line function didn't work within the post_proccess block and it seems like that was the case.

To fix it I created a buffer in the window initialize function

@buffer =

And then I changed your window's draw function to

  def draw
    @buffer.render { draw_3d }
    if button_down?(Gosu::KbTab)
      # Convert the half-over/under image to the desired stereo output format
      post_process (@shader) {
        @buffer.draw 0,0,0
      @buffer.draw 0,0,0

Hope you can get this to work! Looks pretty cool. Hardware-accelerated stereoscopy? Yes, please!
Parent - - By arrow Date 2015-03-09 17:45
One thing that just came to my mind was that it would be cool if you could have images with depth maps like on as game assets.
Parent - By RunnerPack Date 2015-03-09 19:54
Wow, that's pretty cool! Actually, I've been looking for a way to make stereo "sprites" that can be rotated (which you obviously can't do with just a stereo pair), and this might be a good idea to try. Thanks for bringing it to my attention.
Parent - - By RunnerPack Date 2015-03-09 19:51 Edited 2015-03-09 20:05
I thought this, too, but I modified the "bloom" demo that comes with Ashton to include a black line, and it seemed to work fine. How did you test to find out it didn't work?

Your buffer workaround seems to work, which is confusing because Ashton's Window#post_process already uses a buffer system.

Now I have to figure out why the interleaved image is so blurry...
Parent - - By arrow Date 2015-03-09 22:24
Actually I didn't do any testing to find out it didn't work. I just thought it might be so since both the lines and the post processing is done with OpenGL.
Parent - - By RunnerPack Date 2015-03-09 23:24
Well, yeah... everything graphical in Gosu is done with OpenGL. I assume that's what allows shaders to work on Gosu graphics.

Also, if it was just that lines didn't work in the post_process block, they should come back when you release Tab, but they don't. That's what makes me think something weird is going on inside Ashton.
Parent - - By arrow Date 2015-03-10 00:07
Hmm it's not because the lines is done with OpenGL but rather because line drawing is using different OpenGL calls than when you draw images so something could go wrong.
Parent - By RunnerPack Date 2015-03-11 05:24
I think you might be on to something! I disabled your buffer workaround, and tried to draw an image using my Image3D class, along with the test lines. The image didn't show up in either 2D or 3D mode (which is odd), but the lines are there in both modes as if the workaround was in place! It's getting late, but I'll do some more testing, tomorrow.
Parent - - By lol_o2 Date 2015-03-10 10:17
I had a strange experiences with Ashton myself. There was a bug that when you render to texture and then try normal drawing, all images were displaced and you had to call an empty{} block to fix it (not sure if it still happens). Or a bug when trying to read image pixels and Y-axis is inverted somehow.
Parent - - By RunnerPack Date 2015-03-11 05:26
This might be related to the invisible image problem I mentioned above. Do I just put{} at the top of my Window#draw?
Parent - - By lol_o2 Date 2015-03-11 16:33
Actually it was{} (small mistake)
But it won't probably work for your image, because it's only to fix drawing after rendering to another texture. It should be placed after previous finished render block to reset values etc.
Parent - - By RunnerPack Date 2015-03-11 20:13
Yeah, when I include that, it makes the lines all flickery, and prevents the post_process from even working.
I've had no progress at all, BTW. If I draw solid colors in my shader, I get perfect interlaced lines, but when I try to draw from the texture, it's all blurry like it's using a low-resolution version of the window that's been scaled up and bilinear filtered :/
Image3D is still not drawing at all, but a standard Image loading the same PNG works fine.
I'm out of ideas...
Parent - By arrow Date 2015-03-12 15:30
Maybe Spooner can help. You could try submitting a bug report with some test scripts on github.
Up Topic Gosu / Extending Gosu / Ashton causes window to go blank

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill