Win32 API 日本語リファレンス
ホームGraphics.OpenGL › glColor3ui

glColor3ui

関数
符号なし整数値で現在の描画色をRGBで設定する。
DLLOPENGL32.dll呼出規約winapi

シグネチャ

// OPENGL32.dll
#include <windows.h>

void glColor3ui(
    DWORD red,
    DWORD green,
    DWORD blue
);

パラメーター

名前方向
redDWORDin
greenDWORDin
blueDWORDin

戻り値の型: void

各言語での呼び出し定義

// OPENGL32.dll
#include <windows.h>

void glColor3ui(
    DWORD red,
    DWORD green,
    DWORD blue
);
[DllImport("OPENGL32.dll", ExactSpelling = true)]
static extern void glColor3ui(
    uint red,   // DWORD
    uint green,   // DWORD
    uint blue   // DWORD
);
<DllImport("OPENGL32.dll", ExactSpelling:=True)>
Public Shared Sub glColor3ui(
    red As UInteger,   ' DWORD
    green As UInteger,   ' DWORD
    blue As UInteger   ' DWORD
)
End Sub
' red : DWORD
' green : DWORD
' blue : DWORD
Declare PtrSafe Sub glColor3ui Lib "opengl32" ( _
    ByVal red As Long, _
    ByVal green As Long, _
    ByVal blue As Long)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

glColor3ui = ctypes.windll.opengl32.glColor3ui
glColor3ui.restype = None
glColor3ui.argtypes = [
    wintypes.DWORD,  # red : DWORD
    wintypes.DWORD,  # green : DWORD
    wintypes.DWORD,  # blue : DWORD
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('OPENGL32.dll')
glColor3ui = Fiddle::Function.new(
  lib['glColor3ui'],
  [
    -Fiddle::TYPE_INT,  # red : DWORD
    -Fiddle::TYPE_INT,  # green : DWORD
    -Fiddle::TYPE_INT,  # blue : DWORD
  ],
  Fiddle::TYPE_VOID)
#[link(name = "opengl32")]
extern "system" {
    fn glColor3ui(
        red: u32,  // DWORD
        green: u32,  // DWORD
        blue: u32  // DWORD
    );
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("OPENGL32.dll")]
public static extern void glColor3ui(uint red, uint green, uint blue);
"@
$api = Add-Type -MemberDefinition $sig -Name 'OPENGL32_glColor3ui' -Namespace Win32 -PassThru
# $api::glColor3ui(red, green, blue)
#uselib "OPENGL32.dll"
#func global glColor3ui "glColor3ui" sptr, sptr, sptr
; glColor3ui red, green, blue
; red : DWORD -> "sptr"
; green : DWORD -> "sptr"
; blue : DWORD -> "sptr"
#uselib "OPENGL32.dll"
#func global glColor3ui "glColor3ui" int, int, int
; glColor3ui red, green, blue
; red : DWORD -> "int"
; green : DWORD -> "int"
; blue : DWORD -> "int"
; void glColor3ui(DWORD red, DWORD green, DWORD blue)
#uselib "OPENGL32.dll"
#func global glColor3ui "glColor3ui" int, int, int
; glColor3ui red, green, blue
; red : DWORD -> "int"
; green : DWORD -> "int"
; blue : DWORD -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	opengl32 = windows.NewLazySystemDLL("OPENGL32.dll")
	procglColor3ui = opengl32.NewProc("glColor3ui")
)

// red (DWORD), green (DWORD), blue (DWORD)
r1, _, err := procglColor3ui.Call(
	uintptr(red),
	uintptr(green),
	uintptr(blue),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // void
procedure glColor3ui(
  red: DWORD;   // DWORD
  green: DWORD;   // DWORD
  blue: DWORD   // DWORD
); stdcall;
  external 'OPENGL32.dll' name 'glColor3ui';
result := DllCall("OPENGL32\glColor3ui"
    , "UInt", red   ; DWORD
    , "UInt", green   ; DWORD
    , "UInt", blue   ; DWORD
    , "Int")   ; return: void
●glColor3ui(red, green, blue) = DLL("OPENGL32.dll", "int glColor3ui(dword, dword, dword)")
# 呼び出し: glColor3ui(red, green, blue)
# red : DWORD -> "dword"
# green : DWORD -> "dword"
# blue : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。