Not logged inGosu Forums
Forum back to libgosu.org Help Search Register Login
Up Topic Gosu 0.7.27 released (& 0.7.27.1 hotfix)

This board is threaded (i.e. has a tree structure). Please use the Reply button of the specific post you are referring to, not just any random button. If you want to reply to the topic in general, use the Post button near the top and bottom of the page.

Post Reply
In Response to bestguigui
Great work ! Thanks !

By the way, I found a quick and easy way to solve the texture repetition and croping problem :

require "rubygems"
require "gosu"
require "opengl"
include Gl, Glu

class GLTexture
  # GOSU IMAGE -> OPENGL TEXTURE FIX
  # SOLVES PROBLEM WITH REPETITION / CROPING
  def initialize(p_win, filename)
    gosu_image = Gosu::Image.new(p_win, filename, true)
    array_of_pixels = gosu_image.to_blob
    @texture_id = glGenTextures(1)
    glBindTexture(GL_TEXTURE_2D, @texture_id[0])
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, gosu_image.width, gosu_image.height, 0, GL_RGBA, GL_UNSIGNED_BYTE, array_of_pixels)
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST)
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST)
    gosu_image = nil
  end
 
  def get_id
    return @texture_id[0]
  end
end

That way I can easily get a proper texture id and use it in an OpenGL drawing. All that thanks to your new method, Gosu::Image#to_blob ! So, again, thank you !

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill