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

glAlphaFunc

関数
アルファテストの比較関数と基準値を設定する。
DLLOPENGL32.dll呼出規約winapi

シグネチャ

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

void glAlphaFunc(
    DWORD func,
    FLOAT ref
);

パラメーター

名前方向
funcDWORDin
refFLOATin

戻り値の型: void

各言語での呼び出し定義

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

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

glAlphaFunc = ctypes.windll.opengl32.glAlphaFunc
glAlphaFunc.restype = None
glAlphaFunc.argtypes = [
    wintypes.DWORD,  # func : DWORD
    ctypes.c_float,  # ref : FLOAT
]
require 'fiddle'
require 'fiddle/import'

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

var (
	opengl32 = windows.NewLazySystemDLL("OPENGL32.dll")
	procglAlphaFunc = opengl32.NewProc("glAlphaFunc")
)

// func (DWORD), ref (FLOAT)
r1, _, err := procglAlphaFunc.Call(
	uintptr(func),
	uintptr(math.Float32bits(ref)),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // void
// 注意: float/double 引数は proc.Call では XMM レジスタに渡せません。
// windows.SyscallN(proc.Addr(), math.Float64bits(x), ...) もしくは cgo を使用してください。
procedure glAlphaFunc(
  func: DWORD;   // DWORD
  ref: Single   // FLOAT
); stdcall;
  external 'OPENGL32.dll' name 'glAlphaFunc';
result := DllCall("OPENGL32\glAlphaFunc"
    , "UInt", func   ; DWORD
    , "Float", ref   ; FLOAT
    , "Int")   ; return: void
●glAlphaFunc(func, ref) = DLL("OPENGL32.dll", "int glAlphaFunc(dword, float)")
# 呼び出し: glAlphaFunc(func, ref)
# func : DWORD -> "dword"
# ref : FLOAT -> "float"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。