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