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