ホーム › Graphics.OpenGL › gluBuild1DMipmaps
gluBuild1DMipmaps
関数1次元テクスチャのミップマップ群を生成する。
シグネチャ
// GLU32.dll
#include <windows.h>
INT gluBuild1DMipmaps(
DWORD target,
INT components,
INT width,
DWORD format,
DWORD type,
const void* data
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| target | DWORD | in | 対象テクスチャ。通常GL_TEXTURE_1D。 |
| components | INT | in | テクスチャの色成分数(1〜4)または内部形式。 |
| width | INT | in | 元画像の幅(テクセル数)。 |
| format | DWORD | in | ピクセルデータの色形式。GL_RGBAなど。 |
| type | DWORD | in | ピクセルデータの型。GL_UNSIGNED_BYTEなど。 |
| data | void* | in | ミップマップ生成元の画像データへのポインタ。 |
戻り値の型: INT
各言語での呼び出し定義
// GLU32.dll
#include <windows.h>
INT gluBuild1DMipmaps(
DWORD target,
INT components,
INT width,
DWORD format,
DWORD type,
const void* data
);[DllImport("GLU32.dll", ExactSpelling = true)]
static extern int gluBuild1DMipmaps(
uint target, // DWORD
int components, // INT
int width, // INT
uint format, // DWORD
uint type, // DWORD
IntPtr data // void*
);<DllImport("GLU32.dll", ExactSpelling:=True)>
Public Shared Function gluBuild1DMipmaps(
target As UInteger, ' DWORD
components As Integer, ' INT
width 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
' format : DWORD
' type : DWORD
' data : void*
Declare PtrSafe Function gluBuild1DMipmaps Lib "glu32" ( _
ByVal target As Long, _
ByVal components As Long, _
ByVal width 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
gluBuild1DMipmaps = ctypes.windll.glu32.gluBuild1DMipmaps
gluBuild1DMipmaps.restype = ctypes.c_int
gluBuild1DMipmaps.argtypes = [
wintypes.DWORD, # target : DWORD
ctypes.c_int, # components : INT
ctypes.c_int, # width : INT
wintypes.DWORD, # format : DWORD
wintypes.DWORD, # type : DWORD
ctypes.POINTER(None), # data : void*
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('GLU32.dll')
gluBuild1DMipmaps = Fiddle::Function.new(
lib['gluBuild1DMipmaps'],
[
-Fiddle::TYPE_INT, # target : DWORD
Fiddle::TYPE_INT, # components : INT
Fiddle::TYPE_INT, # width : 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 gluBuild1DMipmaps(
target: u32, // DWORD
components: i32, // INT
width: 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 gluBuild1DMipmaps(uint target, int components, int width, uint format, uint type, IntPtr data);
"@
$api = Add-Type -MemberDefinition $sig -Name 'GLU32_gluBuild1DMipmaps' -Namespace Win32 -PassThru
# $api::gluBuild1DMipmaps(target, components, width, format, type, data)#uselib "GLU32.dll"
#func global gluBuild1DMipmaps "gluBuild1DMipmaps" sptr, sptr, sptr, sptr, sptr, sptr
; gluBuild1DMipmaps target, components, width, format, type, data ; 戻り値は stat
; target : DWORD -> "sptr"
; components : INT -> "sptr"
; width : INT -> "sptr"
; format : DWORD -> "sptr"
; type : DWORD -> "sptr"
; data : void* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "GLU32.dll"
#cfunc global gluBuild1DMipmaps "gluBuild1DMipmaps" int, int, int, int, int, sptr
; res = gluBuild1DMipmaps(target, components, width, format, type, data)
; target : DWORD -> "int"
; components : INT -> "int"
; width : INT -> "int"
; format : DWORD -> "int"
; type : DWORD -> "int"
; data : void* -> "sptr"; INT gluBuild1DMipmaps(DWORD target, INT components, INT width, DWORD format, DWORD type, void* data)
#uselib "GLU32.dll"
#cfunc global gluBuild1DMipmaps "gluBuild1DMipmaps" int, int, int, int, int, intptr
; res = gluBuild1DMipmaps(target, components, width, format, type, data)
; target : DWORD -> "int"
; components : INT -> "int"
; width : INT -> "int"
; format : DWORD -> "int"
; type : DWORD -> "int"
; data : void* -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
glu32 = windows.NewLazySystemDLL("GLU32.dll")
procgluBuild1DMipmaps = glu32.NewProc("gluBuild1DMipmaps")
)
// target (DWORD), components (INT), width (INT), format (DWORD), type (DWORD), data (void*)
r1, _, err := procgluBuild1DMipmaps.Call(
uintptr(target),
uintptr(components),
uintptr(width),
uintptr(format),
uintptr(type),
uintptr(data),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction gluBuild1DMipmaps(
target: DWORD; // DWORD
components: Integer; // INT
width: Integer; // INT
format: DWORD; // DWORD
type: DWORD; // DWORD
data: Pointer // void*
): Integer; stdcall;
external 'GLU32.dll' name 'gluBuild1DMipmaps';result := DllCall("GLU32\gluBuild1DMipmaps"
, "UInt", target ; DWORD
, "Int", components ; INT
, "Int", width ; INT
, "UInt", format ; DWORD
, "UInt", type ; DWORD
, "Ptr", data ; void*
, "Int") ; return: INT●gluBuild1DMipmaps(target, components, width, format, type, data) = DLL("GLU32.dll", "int gluBuild1DMipmaps(dword, int, int, dword, dword, void*)")
# 呼び出し: gluBuild1DMipmaps(target, components, width, format, type, data)
# target : DWORD -> "dword"
# components : INT -> "int"
# width : INT -> "int"
# format : DWORD -> "dword"
# type : DWORD -> "dword"
# data : void* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "glu32" fn gluBuild1DMipmaps(
target: u32, // DWORD
components: i32, // INT
width: i32, // INT
format: u32, // DWORD
type: u32, // DWORD
data: ?*anyopaque // void*
) callconv(std.os.windows.WINAPI) i32;proc gluBuild1DMipmaps(
target: uint32, # DWORD
components: int32, # INT
width: int32, # INT
format: uint32, # DWORD
`type`: uint32, # DWORD
data: pointer # void*
): int32 {.importc: "gluBuild1DMipmaps", stdcall, dynlib: "GLU32.dll".}pragma(lib, "glu32");
extern(Windows)
int gluBuild1DMipmaps(
uint target, // DWORD
int components, // INT
int width, // INT
uint format, // DWORD
uint type, // DWORD
void* data // void*
);ccall((:gluBuild1DMipmaps, "GLU32.dll"), stdcall, Int32,
(UInt32, Int32, Int32, UInt32, UInt32, Ptr{Cvoid}),
target, components, width, format, type, data)
# target : DWORD -> UInt32
# components : INT -> Int32
# width : INT -> Int32
# format : DWORD -> UInt32
# type : DWORD -> UInt32
# data : void* -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t gluBuild1DMipmaps(
uint32_t target,
int32_t components,
int32_t width,
uint32_t format,
uint32_t type,
void* data);
]]
local glu32 = ffi.load("glu32")
-- glu32.gluBuild1DMipmaps(target, components, width, format, type, data)
-- target : DWORD
-- components : INT
-- width : INT
-- format : DWORD
-- type : DWORD
-- data : void*
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('GLU32.dll');
const gluBuild1DMipmaps = lib.func('__stdcall', 'gluBuild1DMipmaps', 'int32_t', ['uint32_t', 'int32_t', 'int32_t', 'uint32_t', 'uint32_t', 'void *']);
// gluBuild1DMipmaps(target, components, width, format, type, data)
// target : DWORD -> 'uint32_t'
// components : INT -> 'int32_t'
// width : INT -> 'int32_t'
// format : DWORD -> 'uint32_t'
// type : DWORD -> 'uint32_t'
// data : void* -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("GLU32.dll", {
gluBuild1DMipmaps: { parameters: ["u32", "i32", "i32", "u32", "u32", "pointer"], result: "i32" },
});
// lib.symbols.gluBuild1DMipmaps(target, components, width, format, type, data)
// target : DWORD -> "u32"
// components : INT -> "i32"
// width : INT -> "i32"
// format : DWORD -> "u32"
// type : DWORD -> "u32"
// data : void* -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t gluBuild1DMipmaps(
uint32_t target,
int32_t components,
int32_t width,
uint32_t format,
uint32_t type,
void* data);
C, "GLU32.dll");
// $ffi->gluBuild1DMipmaps(target, components, width, format, type, data);
// target : DWORD
// components : INT
// width : INT
// format : DWORD
// type : DWORD
// data : void*
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Glu32 extends StdCallLibrary {
Glu32 INSTANCE = Native.load("glu32", Glu32.class);
int gluBuild1DMipmaps(
int target, // DWORD
int components, // INT
int width, // INT
int format, // DWORD
int type, // DWORD
Pointer data // void*
);
}@[Link("glu32")]
lib LibGLU32
fun gluBuild1DMipmaps = gluBuild1DMipmaps(
target : UInt32, # DWORD
components : Int32, # INT
width : Int32, # INT
format : UInt32, # DWORD
type_ : UInt32, # DWORD
data : Void* # void*
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef gluBuild1DMipmapsNative = Int32 Function(Uint32, Int32, Int32, Uint32, Uint32, Pointer<Void>);
typedef gluBuild1DMipmapsDart = int Function(int, int, int, int, int, Pointer<Void>);
final gluBuild1DMipmaps = DynamicLibrary.open('GLU32.dll')
.lookupFunction<gluBuild1DMipmapsNative, gluBuild1DMipmapsDart>('gluBuild1DMipmaps');
// target : DWORD -> Uint32
// components : INT -> Int32
// width : INT -> Int32
// format : DWORD -> Uint32
// type : DWORD -> Uint32
// data : void* -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function gluBuild1DMipmaps(
target: DWORD; // DWORD
components: Integer; // INT
width: Integer; // INT
format: DWORD; // DWORD
type: DWORD; // DWORD
data: Pointer // void*
): Integer; stdcall;
external 'GLU32.dll' name 'gluBuild1DMipmaps';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "gluBuild1DMipmaps"
c_gluBuild1DMipmaps :: Word32 -> Int32 -> Int32 -> Word32 -> Word32 -> Ptr () -> IO Int32
-- target : DWORD -> Word32
-- components : INT -> Int32
-- width : INT -> Int32
-- format : DWORD -> Word32
-- type : DWORD -> Word32
-- data : void* -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let glubuild1dmipmaps =
foreign "gluBuild1DMipmaps"
(uint32_t @-> int32_t @-> int32_t @-> uint32_t @-> uint32_t @-> (ptr void) @-> returning int32_t)
(* target : DWORD -> uint32_t *)
(* components : INT -> int32_t *)
(* width : INT -> int32_t *)
(* format : DWORD -> uint32_t *)
(* type : DWORD -> uint32_t *)
(* data : void* -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library glu32 (t "GLU32.dll"))
(cffi:use-foreign-library glu32)
(cffi:defcfun ("gluBuild1DMipmaps" glu-build1-dmipmaps :convention :stdcall) :int32
(target :uint32) ; DWORD
(components :int32) ; INT
(width :int32) ; INT
(format :uint32) ; DWORD
(type :uint32) ; DWORD
(data :pointer)) ; void*
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $gluBuild1DMipmaps = Win32::API::More->new('GLU32',
'int gluBuild1DMipmaps(DWORD target, int components, int width, DWORD format, DWORD type, LPVOID data)');
# my $ret = $gluBuild1DMipmaps->Call($target, $components, $width, $format, $type, $data);
# target : DWORD -> DWORD
# components : INT -> int
# width : INT -> int
# format : DWORD -> DWORD
# type : DWORD -> DWORD
# data : void* -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。