-
-
Save imonmyown/ee3f9aa77e3a6e8b25dc2dba92acefcb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Adapted from SFML Shader example | |
# https://github.com/SFML/SFML/blob/master/examples/shader/Shader.cpp | |
require "crsfml" | |
class Scene | |
def initialize | |
texture = SF::Texture.from_file("resources/bground2.png") | |
texture.repeated = true | |
@sprite = SF::Sprite.new | |
@sprite.texture = texture | |
@sprite.texture_rect = SF.int_rect(0, 0, 800, 600) | |
end | |
def draw(window) | |
window.clear SF::Color::Black | |
window.draw(@sprite) | |
end | |
end | |
#context = SF::ContextSettings.new(0, 0, 0, 3, 2) | |
window = SF::RenderWindow.new( | |
SF::VideoMode.new(800, 600), "SFML Shader", | |
SF::Style::Titlebar | SF::Style::Close#, | |
#context | |
) | |
scene = Scene.new | |
while window.open? | |
while event = window.poll_event | |
case event | |
when SF::Event::Closed | |
window.close | |
end | |
end | |
scene.draw(window) | |
window.display | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Warning. Compatibility profile not supported on this platform. | |
Error. Unable to create the context. Retrying without shared context. | |
Warning. New context created without shared context. | |
Warning: The created OpenGL context does not fully meet the settings that were requested | |
Requested: version = 3.2 ; depth bits = 0 ; stencil bits = 0 ; AA level = 0 ; core = false ; debug = false ; sRGB = false | |
Created: version = 4.1 ; depth bits = 0 ; stencil bits = 0 ; AA level = 0 ; core = true ; debug = false ; sRGB = false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment