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