From 3d8666192178598f0781f9b3e8e267b1a2a00972 Mon Sep 17 00:00:00 2001 From: Cyberarm Date: Sun, 22 Mar 2020 18:13:41 -0500 Subject: [PATCH] Added notice on main menu if opengl version < 3.3 --- lib/ui/menus/main_menu.rb | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/lib/ui/menus/main_menu.rb b/lib/ui/menus/main_menu.rb index f13c42a..ff65aec 100644 --- a/lib/ui/menus/main_menu.rb +++ b/lib/ui/menus/main_menu.rb @@ -20,12 +20,34 @@ class IMICFPS window.close end + gl_version = glGetString(GL_VERSION).to_s + major, minor = gl_version.split(" ").first.split(".").map { |v| v.to_i } + unless major >= 3 && minor >= 3 +message = +"[Notice] Your computer is reporting support for OpenGL #{major}.#{minor}, +however OpenGL 3.3 or higher is required. + +Fallback immediate mode renderer will be used." + +linux_mesa_message = +" + +(Linux Only) For MESA based drivers append --mesa-override +as a commandline argument to override reported version." + message += linux_mesa_message if RUBY_PLATFORM =~ /linux/ && gl_version.downcase.include?(" mesa ") + @old_gl_warning = Gosu::Image.from_markup(message, 24, align: :center) + end + @text = CyberarmEngine::Text.new("#{IMICFPS::NAME} v#{IMICFPS::VERSION} (#{IMICFPS::RELEASE_NAME})") end def draw super + if @old_gl_warning + @old_gl_warning.draw(window.width / 2 - @old_gl_warning.width / 2, window.height - (@old_gl_warning.height + 10), Float::INFINITY) + end + @text.draw @text.x = window.width - (@text.width + 10) @text.y = window.height - (@text.height + 10)