ホーム › Graphics.OpenGL › gluPerspective
gluPerspective
関数視野角とアスペクト比から透視投影行列を設定する。
シグネチャ
// GLU32.dll
#include <windows.h>
void gluPerspective(
DOUBLE fovy,
DOUBLE aspect,
DOUBLE zNear,
DOUBLE zFar
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| fovy | DOUBLE | in |
| aspect | DOUBLE | in |
| zNear | DOUBLE | in |
| zFar | DOUBLE | in |
戻り値の型: void
各言語での呼び出し定義
// GLU32.dll
#include <windows.h>
void gluPerspective(
DOUBLE fovy,
DOUBLE aspect,
DOUBLE zNear,
DOUBLE zFar
);[DllImport("GLU32.dll", ExactSpelling = true)]
static extern void gluPerspective(
double fovy, // DOUBLE
double aspect, // DOUBLE
double zNear, // DOUBLE
double zFar // DOUBLE
);<DllImport("GLU32.dll", ExactSpelling:=True)>
Public Shared Sub gluPerspective(
fovy As Double, ' DOUBLE
aspect As Double, ' DOUBLE
zNear As Double, ' DOUBLE
zFar As Double ' DOUBLE
)
End Sub' fovy : DOUBLE
' aspect : DOUBLE
' zNear : DOUBLE
' zFar : DOUBLE
Declare PtrSafe Sub gluPerspective Lib "glu32" ( _
ByVal fovy As Double, _
ByVal aspect As Double, _
ByVal zNear As Double, _
ByVal zFar As Double)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
gluPerspective = ctypes.windll.glu32.gluPerspective
gluPerspective.restype = None
gluPerspective.argtypes = [
ctypes.c_double, # fovy : DOUBLE
ctypes.c_double, # aspect : DOUBLE
ctypes.c_double, # zNear : DOUBLE
ctypes.c_double, # zFar : DOUBLE
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('GLU32.dll')
gluPerspective = Fiddle::Function.new(
lib['gluPerspective'],
[
Fiddle::TYPE_DOUBLE, # fovy : DOUBLE
Fiddle::TYPE_DOUBLE, # aspect : DOUBLE
Fiddle::TYPE_DOUBLE, # zNear : DOUBLE
Fiddle::TYPE_DOUBLE, # zFar : DOUBLE
],
Fiddle::TYPE_VOID)#[link(name = "glu32")]
extern "system" {
fn gluPerspective(
fovy: f64, // DOUBLE
aspect: f64, // DOUBLE
zNear: f64, // DOUBLE
zFar: f64 // DOUBLE
);
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("GLU32.dll")]
public static extern void gluPerspective(double fovy, double aspect, double zNear, double zFar);
"@
$api = Add-Type -MemberDefinition $sig -Name 'GLU32_gluPerspective' -Namespace Win32 -PassThru
# $api::gluPerspective(fovy, aspect, zNear, zFar)#uselib "GLU32.dll"
#func global gluPerspective "gluPerspective" double, double, double, double
; gluPerspective fovy, aspect, zNear, zFar
; fovy : DOUBLE -> "double"
; aspect : DOUBLE -> "double"
; zNear : DOUBLE -> "double"
; zFar : DOUBLE -> "double"#uselib "GLU32.dll"
#func global gluPerspective "gluPerspective" double, double, double, double
; gluPerspective fovy, aspect, zNear, zFar
; fovy : DOUBLE -> "double"
; aspect : DOUBLE -> "double"
; zNear : DOUBLE -> "double"
; zFar : DOUBLE -> "double"; void gluPerspective(DOUBLE fovy, DOUBLE aspect, DOUBLE zNear, DOUBLE zFar)
#uselib "GLU32.dll"
#func global gluPerspective "gluPerspective" double, double, double, double
; gluPerspective fovy, aspect, zNear, zFar
; fovy : DOUBLE -> "double"
; aspect : DOUBLE -> "double"
; zNear : DOUBLE -> "double"
; zFar : DOUBLE -> "double"import (
"math"
"golang.org/x/sys/windows"
"unsafe"
)
var (
glu32 = windows.NewLazySystemDLL("GLU32.dll")
procgluPerspective = glu32.NewProc("gluPerspective")
)
// fovy (DOUBLE), aspect (DOUBLE), zNear (DOUBLE), zFar (DOUBLE)
r1, _, err := procgluPerspective.Call(
uintptr(math.Float64bits(fovy)),
uintptr(math.Float64bits(aspect)),
uintptr(math.Float64bits(zNear)),
uintptr(math.Float64bits(zFar)),
)
_ = 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 gluPerspective(
fovy: Double; // DOUBLE
aspect: Double; // DOUBLE
zNear: Double; // DOUBLE
zFar: Double // DOUBLE
); stdcall;
external 'GLU32.dll' name 'gluPerspective';result := DllCall("GLU32\gluPerspective"
, "Double", fovy ; DOUBLE
, "Double", aspect ; DOUBLE
, "Double", zNear ; DOUBLE
, "Double", zFar ; DOUBLE
, "Int") ; return: void●gluPerspective(fovy, aspect, zNear, zFar) = DLL("GLU32.dll", "int gluPerspective(double, double, double, double)")
# 呼び出し: gluPerspective(fovy, aspect, zNear, zFar)
# fovy : DOUBLE -> "double"
# aspect : DOUBLE -> "double"
# zNear : DOUBLE -> "double"
# zFar : DOUBLE -> "double"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。