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