mirror of
https://github.com/cyberarm/i-mic-fps.git
synced 2025-12-16 08:02:36 +00:00
Textures work! that 3 was only getting 2... Added --native to lunch game at native resolution and fullscreen. Added basic plane.
This commit is contained in:
@@ -17,19 +17,20 @@ class IMICFPS
|
||||
puts "#{name} texture #{texture_path}"
|
||||
@texture = Gosu::Image.new(texture_path, retro: true)
|
||||
array_of_pixels = @texture.to_blob
|
||||
if @texture.gl_tex_info
|
||||
@texture_id = @texture.gl_tex_info.tex_name
|
||||
else
|
||||
puts "Allocating..."
|
||||
tex_names_buf = ' ' * 8
|
||||
glGenTextures(1, tex_names_buf)
|
||||
@texture_id = tex_names_buf.unpack('L2').first
|
||||
end
|
||||
|
||||
tex_names_buf = ' ' * 8
|
||||
glGenTextures(1, tex_names_buf)
|
||||
@texture_id = tex_names_buf.unpack('L2').first
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, @texture_id)
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, @texture.width, @texture.height, 0, GL_RGBA, GL_UNSIGNED_BYTE, array_of_pixels)
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT)
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT)
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR)
|
||||
glGenerateMipmap(GL_TEXTURE_2D)
|
||||
|
||||
@texture = nil
|
||||
end
|
||||
|
||||
def texture_id
|
||||
|
||||
Reference in New Issue
Block a user