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

gluBuild2DMipmaps

関数
2次元テクスチャのミップマップ群を生成する。
DLLGLU32.dll呼出規約winapi

シグネチャ

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

INT gluBuild2DMipmaps(
    DWORD target,
    INT components,
    INT width,
    INT height,
    DWORD format,
    DWORD type,
    const void* data
);

パラメーター

名前方向
targetDWORDin
componentsINTin
widthINTin
heightINTin
formatDWORDin
typeDWORDin
datavoid*in

戻り値の型: INT

各言語での呼び出し定義

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

INT gluBuild2DMipmaps(
    DWORD target,
    INT components,
    INT width,
    INT height,
    DWORD format,
    DWORD type,
    const void* data
);
[DllImport("GLU32.dll", ExactSpelling = true)]
static extern int gluBuild2DMipmaps(
    uint target,   // DWORD
    int components,   // INT
    int width,   // INT
    int height,   // INT
    uint format,   // DWORD
    uint type,   // DWORD
    IntPtr data   // void*
);
<DllImport("GLU32.dll", ExactSpelling:=True)>
Public Shared Function gluBuild2DMipmaps(
    target As UInteger,   ' DWORD
    components As Integer,   ' INT
    width As Integer,   ' INT
    height As Integer,   ' INT
    format As UInteger,   ' DWORD
    type As UInteger,   ' DWORD
    data As IntPtr   ' void*
) As Integer
End Function
' target : DWORD
' components : INT
' width : INT
' height : INT
' format : DWORD
' type : DWORD
' data : void*
Declare PtrSafe Function gluBuild2DMipmaps Lib "glu32" ( _
    ByVal target As Long, _
    ByVal components As Long, _
    ByVal width As Long, _
    ByVal height As Long, _
    ByVal format As Long, _
    ByVal type As Long, _
    ByVal data As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

gluBuild2DMipmaps = ctypes.windll.glu32.gluBuild2DMipmaps
gluBuild2DMipmaps.restype = ctypes.c_int
gluBuild2DMipmaps.argtypes = [
    wintypes.DWORD,  # target : DWORD
    ctypes.c_int,  # components : INT
    ctypes.c_int,  # width : INT
    ctypes.c_int,  # height : INT
    wintypes.DWORD,  # format : DWORD
    wintypes.DWORD,  # type : DWORD
    ctypes.POINTER(None),  # data : void*
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('GLU32.dll')
gluBuild2DMipmaps = Fiddle::Function.new(
  lib['gluBuild2DMipmaps'],
  [
    -Fiddle::TYPE_INT,  # target : DWORD
    Fiddle::TYPE_INT,  # components : INT
    Fiddle::TYPE_INT,  # width : INT
    Fiddle::TYPE_INT,  # height : INT
    -Fiddle::TYPE_INT,  # format : DWORD
    -Fiddle::TYPE_INT,  # type : DWORD
    Fiddle::TYPE_VOIDP,  # data : void*
  ],
  Fiddle::TYPE_INT)
#[link(name = "glu32")]
extern "system" {
    fn gluBuild2DMipmaps(
        target: u32,  // DWORD
        components: i32,  // INT
        width: i32,  // INT
        height: i32,  // INT
        format: u32,  // DWORD
        type: u32,  // DWORD
        data: *const ()  // void*
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("GLU32.dll")]
public static extern int gluBuild2DMipmaps(uint target, int components, int width, int height, uint format, uint type, IntPtr data);
"@
$api = Add-Type -MemberDefinition $sig -Name 'GLU32_gluBuild2DMipmaps' -Namespace Win32 -PassThru
# $api::gluBuild2DMipmaps(target, components, width, height, format, type, data)
#uselib "GLU32.dll"
#func global gluBuild2DMipmaps "gluBuild2DMipmaps" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; gluBuild2DMipmaps target, components, width, height, format, type, data   ; 戻り値は stat
; target : DWORD -> "sptr"
; components : INT -> "sptr"
; width : INT -> "sptr"
; height : INT -> "sptr"
; format : DWORD -> "sptr"
; type : DWORD -> "sptr"
; data : void* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "GLU32.dll"
#cfunc global gluBuild2DMipmaps "gluBuild2DMipmaps" int, int, int, int, int, int, sptr
; res = gluBuild2DMipmaps(target, components, width, height, format, type, data)
; target : DWORD -> "int"
; components : INT -> "int"
; width : INT -> "int"
; height : INT -> "int"
; format : DWORD -> "int"
; type : DWORD -> "int"
; data : void* -> "sptr"
; INT gluBuild2DMipmaps(DWORD target, INT components, INT width, INT height, DWORD format, DWORD type, void* data)
#uselib "GLU32.dll"
#cfunc global gluBuild2DMipmaps "gluBuild2DMipmaps" int, int, int, int, int, int, intptr
; res = gluBuild2DMipmaps(target, components, width, height, format, type, data)
; target : DWORD -> "int"
; components : INT -> "int"
; width : INT -> "int"
; height : INT -> "int"
; format : DWORD -> "int"
; type : DWORD -> "int"
; data : void* -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	glu32 = windows.NewLazySystemDLL("GLU32.dll")
	procgluBuild2DMipmaps = glu32.NewProc("gluBuild2DMipmaps")
)

// target (DWORD), components (INT), width (INT), height (INT), format (DWORD), type (DWORD), data (void*)
r1, _, err := procgluBuild2DMipmaps.Call(
	uintptr(target),
	uintptr(components),
	uintptr(width),
	uintptr(height),
	uintptr(format),
	uintptr(type),
	uintptr(data),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // INT
function gluBuild2DMipmaps(
  target: DWORD;   // DWORD
  components: Integer;   // INT
  width: Integer;   // INT
  height: Integer;   // INT
  format: DWORD;   // DWORD
  type: DWORD;   // DWORD
  data: Pointer   // void*
): Integer; stdcall;
  external 'GLU32.dll' name 'gluBuild2DMipmaps';
result := DllCall("GLU32\gluBuild2DMipmaps"
    , "UInt", target   ; DWORD
    , "Int", components   ; INT
    , "Int", width   ; INT
    , "Int", height   ; INT
    , "UInt", format   ; DWORD
    , "UInt", type   ; DWORD
    , "Ptr", data   ; void*
    , "Int")   ; return: INT
●gluBuild2DMipmaps(target, components, width, height, format, type, data) = DLL("GLU32.dll", "int gluBuild2DMipmaps(dword, int, int, int, dword, dword, void*)")
# 呼び出し: gluBuild2DMipmaps(target, components, width, height, format, type, data)
# target : DWORD -> "dword"
# components : INT -> "int"
# width : INT -> "int"
# height : INT -> "int"
# format : DWORD -> "dword"
# type : DWORD -> "dword"
# data : void* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。