ホーム › Graphics.OpenGL › gluOrtho2D
gluOrtho2D
関数2次元の正射影変換行列を設定する。
シグネチャ
// GLU32.dll
#include <windows.h>
void gluOrtho2D(
DOUBLE left,
DOUBLE right,
DOUBLE bottom,
DOUBLE top
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| left | DOUBLE | in |
| right | DOUBLE | in |
| bottom | DOUBLE | in |
| top | DOUBLE | in |
戻り値の型: void
各言語での呼び出し定義
// GLU32.dll
#include <windows.h>
void gluOrtho2D(
DOUBLE left,
DOUBLE right,
DOUBLE bottom,
DOUBLE top
);[DllImport("GLU32.dll", ExactSpelling = true)]
static extern void gluOrtho2D(
double left, // DOUBLE
double right, // DOUBLE
double bottom, // DOUBLE
double top // DOUBLE
);<DllImport("GLU32.dll", ExactSpelling:=True)>
Public Shared Sub gluOrtho2D(
left As Double, ' DOUBLE
right As Double, ' DOUBLE
bottom As Double, ' DOUBLE
top As Double ' DOUBLE
)
End Sub' left : DOUBLE
' right : DOUBLE
' bottom : DOUBLE
' top : DOUBLE
Declare PtrSafe Sub gluOrtho2D Lib "glu32" ( _
ByVal left As Double, _
ByVal right As Double, _
ByVal bottom As Double, _
ByVal top As Double)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
gluOrtho2D = ctypes.windll.glu32.gluOrtho2D
gluOrtho2D.restype = None
gluOrtho2D.argtypes = [
ctypes.c_double, # left : DOUBLE
ctypes.c_double, # right : DOUBLE
ctypes.c_double, # bottom : DOUBLE
ctypes.c_double, # top : DOUBLE
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('GLU32.dll')
gluOrtho2D = Fiddle::Function.new(
lib['gluOrtho2D'],
[
Fiddle::TYPE_DOUBLE, # left : DOUBLE
Fiddle::TYPE_DOUBLE, # right : DOUBLE
Fiddle::TYPE_DOUBLE, # bottom : DOUBLE
Fiddle::TYPE_DOUBLE, # top : DOUBLE
],
Fiddle::TYPE_VOID)#[link(name = "glu32")]
extern "system" {
fn gluOrtho2D(
left: f64, // DOUBLE
right: f64, // DOUBLE
bottom: f64, // DOUBLE
top: f64 // DOUBLE
);
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("GLU32.dll")]
public static extern void gluOrtho2D(double left, double right, double bottom, double top);
"@
$api = Add-Type -MemberDefinition $sig -Name 'GLU32_gluOrtho2D' -Namespace Win32 -PassThru
# $api::gluOrtho2D(left, right, bottom, top)#uselib "GLU32.dll"
#func global gluOrtho2D "gluOrtho2D" double, double, double, double
; gluOrtho2D left, right, bottom, top
; left : DOUBLE -> "double"
; right : DOUBLE -> "double"
; bottom : DOUBLE -> "double"
; top : DOUBLE -> "double"#uselib "GLU32.dll"
#func global gluOrtho2D "gluOrtho2D" double, double, double, double
; gluOrtho2D left, right, bottom, top
; left : DOUBLE -> "double"
; right : DOUBLE -> "double"
; bottom : DOUBLE -> "double"
; top : DOUBLE -> "double"; void gluOrtho2D(DOUBLE left, DOUBLE right, DOUBLE bottom, DOUBLE top)
#uselib "GLU32.dll"
#func global gluOrtho2D "gluOrtho2D" double, double, double, double
; gluOrtho2D left, right, bottom, top
; left : DOUBLE -> "double"
; right : DOUBLE -> "double"
; bottom : DOUBLE -> "double"
; top : DOUBLE -> "double"import (
"math"
"golang.org/x/sys/windows"
"unsafe"
)
var (
glu32 = windows.NewLazySystemDLL("GLU32.dll")
procgluOrtho2D = glu32.NewProc("gluOrtho2D")
)
// left (DOUBLE), right (DOUBLE), bottom (DOUBLE), top (DOUBLE)
r1, _, err := procgluOrtho2D.Call(
uintptr(math.Float64bits(left)),
uintptr(math.Float64bits(right)),
uintptr(math.Float64bits(bottom)),
uintptr(math.Float64bits(top)),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // void
// 注意: float/double 引数は proc.Call では XMM レジスタに渡せません。
// windows.SyscallN(proc.Addr(), math.Float64bits(x), ...) もしくは cgo を使用してください。procedure gluOrtho2D(
left: Double; // DOUBLE
right: Double; // DOUBLE
bottom: Double; // DOUBLE
top: Double // DOUBLE
); stdcall;
external 'GLU32.dll' name 'gluOrtho2D';result := DllCall("GLU32\gluOrtho2D"
, "Double", left ; DOUBLE
, "Double", right ; DOUBLE
, "Double", bottom ; DOUBLE
, "Double", top ; DOUBLE
, "Int") ; return: void●gluOrtho2D(left, right, bottom, top) = DLL("GLU32.dll", "int gluOrtho2D(double, double, double, double)")
# 呼び出し: gluOrtho2D(left, right, bottom, top)
# left : DOUBLE -> "double"
# right : DOUBLE -> "double"
# bottom : DOUBLE -> "double"
# top : DOUBLE -> "double"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。