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