ホーム › Graphics.OpenGL › gluPickMatrix
gluPickMatrix
関数ピッキング用に指定領域に限定する投影行列を設定する。
シグネチャ
// GLU32.dll
#include <windows.h>
void gluPickMatrix(
DOUBLE x,
DOUBLE y,
DOUBLE width,
DOUBLE height,
INT* viewport
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| x | DOUBLE | in |
| y | DOUBLE | in |
| width | DOUBLE | in |
| height | DOUBLE | in |
| viewport | INT* | inout |
戻り値の型: void
各言語での呼び出し定義
// GLU32.dll
#include <windows.h>
void gluPickMatrix(
DOUBLE x,
DOUBLE y,
DOUBLE width,
DOUBLE height,
INT* viewport
);[DllImport("GLU32.dll", ExactSpelling = true)]
static extern void gluPickMatrix(
double x, // DOUBLE
double y, // DOUBLE
double width, // DOUBLE
double height, // DOUBLE
ref int viewport // INT* in/out
);<DllImport("GLU32.dll", ExactSpelling:=True)>
Public Shared Sub gluPickMatrix(
x As Double, ' DOUBLE
y As Double, ' DOUBLE
width As Double, ' DOUBLE
height As Double, ' DOUBLE
ByRef viewport As Integer ' INT* in/out
)
End Sub' x : DOUBLE
' y : DOUBLE
' width : DOUBLE
' height : DOUBLE
' viewport : INT* in/out
Declare PtrSafe Sub gluPickMatrix Lib "glu32" ( _
ByVal x As Double, _
ByVal y As Double, _
ByVal width As Double, _
ByVal height As Double, _
ByRef viewport As Long)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
gluPickMatrix = ctypes.windll.glu32.gluPickMatrix
gluPickMatrix.restype = None
gluPickMatrix.argtypes = [
ctypes.c_double, # x : DOUBLE
ctypes.c_double, # y : DOUBLE
ctypes.c_double, # width : DOUBLE
ctypes.c_double, # height : DOUBLE
ctypes.POINTER(ctypes.c_int), # viewport : INT* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('GLU32.dll')
gluPickMatrix = Fiddle::Function.new(
lib['gluPickMatrix'],
[
Fiddle::TYPE_DOUBLE, # x : DOUBLE
Fiddle::TYPE_DOUBLE, # y : DOUBLE
Fiddle::TYPE_DOUBLE, # width : DOUBLE
Fiddle::TYPE_DOUBLE, # height : DOUBLE
Fiddle::TYPE_VOIDP, # viewport : INT* in/out
],
Fiddle::TYPE_VOID)#[link(name = "glu32")]
extern "system" {
fn gluPickMatrix(
x: f64, // DOUBLE
y: f64, // DOUBLE
width: f64, // DOUBLE
height: f64, // DOUBLE
viewport: *mut i32 // INT* in/out
);
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("GLU32.dll")]
public static extern void gluPickMatrix(double x, double y, double width, double height, ref int viewport);
"@
$api = Add-Type -MemberDefinition $sig -Name 'GLU32_gluPickMatrix' -Namespace Win32 -PassThru
# $api::gluPickMatrix(x, y, width, height, viewport)#uselib "GLU32.dll"
#func global gluPickMatrix "gluPickMatrix" double, double, double, double, sptr
; gluPickMatrix x, y, width, height, varptr(viewport)
; x : DOUBLE -> "double"
; y : DOUBLE -> "double"
; width : DOUBLE -> "double"
; height : DOUBLE -> "double"
; viewport : INT* in/out -> "sptr"出力引数:
#uselib "GLU32.dll" #func global gluPickMatrix "gluPickMatrix" double, double, double, double, var ; gluPickMatrix x, y, width, height, viewport ; x : DOUBLE -> "double" ; y : DOUBLE -> "double" ; width : DOUBLE -> "double" ; height : DOUBLE -> "double" ; viewport : INT* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "GLU32.dll" #func global gluPickMatrix "gluPickMatrix" double, double, double, double, sptr ; gluPickMatrix x, y, width, height, varptr(viewport) ; x : DOUBLE -> "double" ; y : DOUBLE -> "double" ; width : DOUBLE -> "double" ; height : DOUBLE -> "double" ; viewport : INT* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; void gluPickMatrix(DOUBLE x, DOUBLE y, DOUBLE width, DOUBLE height, INT* viewport) #uselib "GLU32.dll" #func global gluPickMatrix "gluPickMatrix" double, double, double, double, var ; gluPickMatrix x, y, width, height, viewport ; x : DOUBLE -> "double" ; y : DOUBLE -> "double" ; width : DOUBLE -> "double" ; height : DOUBLE -> "double" ; viewport : INT* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; void gluPickMatrix(DOUBLE x, DOUBLE y, DOUBLE width, DOUBLE height, INT* viewport) #uselib "GLU32.dll" #func global gluPickMatrix "gluPickMatrix" double, double, double, double, intptr ; gluPickMatrix x, y, width, height, varptr(viewport) ; x : DOUBLE -> "double" ; y : DOUBLE -> "double" ; width : DOUBLE -> "double" ; height : DOUBLE -> "double" ; viewport : INT* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"math"
"golang.org/x/sys/windows"
"unsafe"
)
var (
glu32 = windows.NewLazySystemDLL("GLU32.dll")
procgluPickMatrix = glu32.NewProc("gluPickMatrix")
)
// x (DOUBLE), y (DOUBLE), width (DOUBLE), height (DOUBLE), viewport (INT* in/out)
r1, _, err := procgluPickMatrix.Call(
uintptr(math.Float64bits(x)),
uintptr(math.Float64bits(y)),
uintptr(math.Float64bits(width)),
uintptr(math.Float64bits(height)),
uintptr(viewport),
)
_ = 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 gluPickMatrix(
x: Double; // DOUBLE
y: Double; // DOUBLE
width: Double; // DOUBLE
height: Double; // DOUBLE
viewport: Pointer // INT* in/out
); stdcall;
external 'GLU32.dll' name 'gluPickMatrix';result := DllCall("GLU32\gluPickMatrix"
, "Double", x ; DOUBLE
, "Double", y ; DOUBLE
, "Double", width ; DOUBLE
, "Double", height ; DOUBLE
, "Ptr", viewport ; INT* in/out
, "Int") ; return: void●gluPickMatrix(x, y, width, height, viewport) = DLL("GLU32.dll", "int gluPickMatrix(double, double, double, double, void*)")
# 呼び出し: gluPickMatrix(x, y, width, height, viewport)
# x : DOUBLE -> "double"
# y : DOUBLE -> "double"
# width : DOUBLE -> "double"
# height : DOUBLE -> "double"
# viewport : INT* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。