Not logged inGosu Forums
Forum back to libgosu.org Help Search Register Login
Up Topic Gosu / Gosu Exchange / Have a screen render with Gosu::Image
- - By Wano Date 2015-12-21 14:20
I have this code :


image = Gosu::Image.new("Datas/editor/render.png") # a white 640 x 480 image
glBindTexture(GL_TEXTURE_2D, image.gl_tex_info.tex_name)
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, 640, 480)
image.save(certain_path)


It's working good, exept that the returned image is inverted on Y axis. How should I proceed to get the right image ?

- Find a way to rotate the image after getting it, but Gosu::Image is limited so I should pass to another library that can manipulate images
- Find options to invert Y axis before copying rendering
Parent - - By jlnr (dev) Date 2015-12-21 15:13
Are you rendering to an OpenGL texture? If so, can you simply invert the matrix while you are rendering, so that the image data won't be inverted to begin with?
Parent - - By Wano Date 2015-12-21 16:50
Yep, but I dunno which matrix I should invert.
Parent - - By jlnr (dev) Date 2015-12-21 21:22
Are you using plain Gosu to render? Then it should be as easy as Gosu::scale(1, -1, 0, window.height / 2) { ...draw everything... }
Parent - By Wano Date 2015-12-22 17:29
Thank you for your answer, it helped me to figure out my problem ! It was a configuration for me camera while setting my projection matrix :

glMatrixMode(GL_PROJECTION)
glLoadIdentity
glScale(1.0,-1.0,1.0) if $window.screen


Sorry, this totally was an OpenGL problem. x)
Up Topic Gosu / Gosu Exchange / Have a screen render with Gosu::Image

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill