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

glStencilFunc

関数
ステンシルテストの比較関数と参照値を設定する。
DLLOPENGL32.dll呼出規約winapi

シグネチャ

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

void glStencilFunc(
    DWORD func,
    INT ref,
    DWORD mask
);

パラメーター

名前方向
funcDWORDin
refINTin
maskDWORDin

戻り値の型: void

各言語での呼び出し定義

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

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

glStencilFunc = ctypes.windll.opengl32.glStencilFunc
glStencilFunc.restype = None
glStencilFunc.argtypes = [
    wintypes.DWORD,  # func : DWORD
    ctypes.c_int,  # ref : INT
    wintypes.DWORD,  # mask : DWORD
]
require 'fiddle'
require 'fiddle/import'

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

var (
	opengl32 = windows.NewLazySystemDLL("OPENGL32.dll")
	procglStencilFunc = opengl32.NewProc("glStencilFunc")
)

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