Skip to content

Support FreeBSD #41

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,13 @@ https://github.com/vaiorabbit/ruby-opengl
## Contents ##

* 'opengl.rb' includes these scripts:
* 'opengl_command.rb' : OpenGL command wrapper (glDrawRangeElements, etc.). Generated via generator/generate_command.rb.
* 'opengl_enum.rb' : OpenGL enum wrapper (GL_TRIANGLE_STRIP, etc.). Generated via generator/generate_enum.rb.
* 'opengl_common.rb' : Provides utility functions.
* 'opengl_platform.rb' : Provides platform check functions (OpneGL.get_platform).
* 'opengl_windows.rb' : Provides functions for Windows platform (wglGetProcAddress, wglGetCurrentContext, wglGetCurrentDC).
* 'opengl_macosx.rb' : Provides functions for Mac OS X platform (CGLGetCurrentContext, CGLGetShareGroup).
* 'opengl_linux.rb' : Provides functions for Linux (X Window) platform (glXGetCurrentContext, glXGetCurrentDisplay).
* 'opengl_command.rb' : OpenGL command wrapper (glDrawRangeElements, etc.). Generated via generator/generate_command.rb.
* 'opengl_enum.rb' : OpenGL enum wrapper (GL_TRIANGLE_STRIP, etc.). Generated via generator/generate_enum.rb.
* 'opengl_common.rb' : Provides utility functions.
* 'opengl_platform.rb' : Provides platform check functions (OpneGL.get_platform).
* 'opengl_interface_cgl.rb' : Provides functions for the Mac OS X platform (CGLGetCurrentContext, CGLGetShareGroup).
* 'opengl_interface_glx.rb' : Provides functions for various X11 platforms (glXGetCurrentContext, glXGetCurrentDisplay).
* 'opengl_interface_wgl.rb' : Provides functions for the Windows platform (wglGetProcAddress, wglGetCurrentContext, wglGetCurrentDC).

* 'opengl_es.rb' is almost the same with 'opengl.rb', except for including 'opengl_es_command.rb' and 'opengl_es_enum.rb'.

Expand Down Expand Up @@ -489,13 +489,13 @@ https://github.com/vaiorabbit/ruby-opengl
## 内容 ##

* 'opengl.rb' を require することで下記のスクリプトを取り込みます:
* 'opengl_command.rb' : OpenGL 関数のラッパーコード (glDrawRangeElements, etc.)。 generator/generate_command.rb で自動生成されたものです。
* 'opengl_enum.rb' : OpenGL enum のラッパーコード (GL_TRIANGLE_STRIP, etc.)。 generator/generate_enum.rb で自動生成されたものです。
* 'opengl_common.rb' : 共通のユーティリティ関数を提供しています。
* 'opengl_platform.rb' : 動作プラットフォームの判別機能を提供しています (OpneGL.get_platform)。
* 'opengl_windows.rb' : Windows 用の機能を提供しています (wglGetProcAddress, wglGetCurrentContext, wglGetCurrentDC).
* 'opengl_macosx.rb' : Mac OS X 用の機能を提供しています (CGLGetCurrentContext, CGLGetShareGroup).
* 'opengl_linux.rb' : Linux (X Window) 用の機能を提供しています (glXGetCurrentContext, glXGetCurrentDisplay).
* 'opengl_command.rb' : OpenGL 関数のラッパーコード (glDrawRangeElements, etc.)。 generator/generate_command.rb で自動生成されたものです。
* 'opengl_enum.rb' : OpenGL enum のラッパーコード (GL_TRIANGLE_STRIP, etc.)。 generator/generate_enum.rb で自動生成されたものです。
* 'opengl_common.rb' : 共通のユーティリティ関数を提供しています。
* 'opengl_platform.rb' : 動作プラットフォームの判別機能を提供しています (OpneGL.get_platform)。
* 'opengl_interface_cgl.rb' : Mac OS X 用の機能を提供しています (CGLGetCurrentContext, CGLGetShareGroup).
* 'opengl_interface_glx.rb' : X11 用の機能を提供しています (glXGetCurrentContext, glXGetCurrentDisplay).
* 'opengl_interface_wgl.rb' : Windows 用の機能を提供しています (wglGetProcAddress, wglGetCurrentContext, wglGetCurrentDC).

* 'opengl_es.rb' は 'opengl_es_command.rb' と 'opengl_es_enum.rb' を取り込む以外は 'opengl.rb' と同じです。

Expand Down
8 changes: 4 additions & 4 deletions lib/opengl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
require_relative 'opengl_command'
case GL.get_platform
when :OPENGL_PLATFORM_WINDOWS
require_relative 'opengl_windows'
require_relative 'opengl_interface_wgl'
when :OPENGL_PLATFORM_MACOSX
require_relative 'opengl_macosx'
when :OPENGL_PLATFORM_LINUX
require_relative 'opengl_linux'
require_relative 'opengl_interface_cgl'
when :OPENGL_PLATFORM_LINUX, :OPENGL_PLATFORM_FREEBSD
require_relative 'opengl_interface_glx'
end

=begin
Expand Down
2 changes: 1 addition & 1 deletion lib/opengl_es.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require_relative 'opengl_es_enum'
require_relative 'opengl_es_command'
if GL.get_platform == :OPENGL_PLATFORM_WINDOWS
require_relative 'opengl_windows'
require_relative 'opengl_interface_wgl'
end

=begin
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 5 additions & 1 deletion lib/opengl_platform.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
require 'rbconfig'

module GL
@@opengl_platform = case RbConfig::CONFIG['host_os']
host_os = RbConfig::CONFIG['host_os']

@@opengl_platform = case host_os
when /mswin|msys|mingw|cygwin/
:OPENGL_PLATFORM_WINDOWS
when /darwin/
:OPENGL_PLATFORM_MACOSX
when /linux/
:OPENGL_PLATFORM_LINUX
when /freebsd/
:OPENGL_PLATFORM_FREEBSD
else
raise RuntimeError, "OpenGL : Unknown OS: #{host_os.inspect}"
end
Expand Down