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

glGenTextures

関数
未使用のテクスチャオブジェクト名を生成する。
DLLOPENGL32.dll呼出規約winapi

シグネチャ

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

void glGenTextures(
    INT n,
    DWORD* textures
);

パラメーター

名前方向
nINTin
texturesDWORD*inout

戻り値の型: void

各言語での呼び出し定義

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

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

glGenTextures = ctypes.windll.opengl32.glGenTextures
glGenTextures.restype = None
glGenTextures.argtypes = [
    ctypes.c_int,  # n : INT
    ctypes.POINTER(wintypes.DWORD),  # textures : DWORD* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('OPENGL32.dll')
glGenTextures = Fiddle::Function.new(
  lib['glGenTextures'],
  [
    Fiddle::TYPE_INT,  # n : INT
    Fiddle::TYPE_VOIDP,  # textures : DWORD* in/out
  ],
  Fiddle::TYPE_VOID)
#[link(name = "opengl32")]
extern "system" {
    fn glGenTextures(
        n: i32,  // INT
        textures: *mut u32  // DWORD* in/out
    );
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("OPENGL32.dll")]
public static extern void glGenTextures(int n, ref uint textures);
"@
$api = Add-Type -MemberDefinition $sig -Name 'OPENGL32_glGenTextures' -Namespace Win32 -PassThru
# $api::glGenTextures(n, textures)
#uselib "OPENGL32.dll"
#func global glGenTextures "glGenTextures" sptr, sptr
; glGenTextures n, varptr(textures)
; n : INT -> "sptr"
; textures : DWORD* in/out -> "sptr"
出力引数:
#uselib "OPENGL32.dll"
#func global glGenTextures "glGenTextures" int, var
; glGenTextures n, textures
; n : INT -> "int"
; textures : DWORD* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; void glGenTextures(INT n, DWORD* textures)
#uselib "OPENGL32.dll"
#func global glGenTextures "glGenTextures" int, var
; glGenTextures n, textures
; n : INT -> "int"
; textures : DWORD* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	opengl32 = windows.NewLazySystemDLL("OPENGL32.dll")
	procglGenTextures = opengl32.NewProc("glGenTextures")
)

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