ホーム › Graphics.OpenGL › glGetTexImage
glGetTexImage
関数指定したテクスチャ画像をメモリへ取得する。
シグネチャ
// OPENGL32.dll
#include <windows.h>
void glGetTexImage(
DWORD target,
INT level,
DWORD format,
DWORD type,
void* pixels
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| target | DWORD | in |
| level | INT | in |
| format | DWORD | in |
| type | DWORD | in |
| pixels | void* | inout |
戻り値の型: void
各言語での呼び出し定義
// OPENGL32.dll
#include <windows.h>
void glGetTexImage(
DWORD target,
INT level,
DWORD format,
DWORD type,
void* pixels
);[DllImport("OPENGL32.dll", ExactSpelling = true)]
static extern void glGetTexImage(
uint target, // DWORD
int level, // INT
uint format, // DWORD
uint type, // DWORD
IntPtr pixels // void* in/out
);<DllImport("OPENGL32.dll", ExactSpelling:=True)>
Public Shared Sub glGetTexImage(
target As UInteger, ' DWORD
level As Integer, ' INT
format As UInteger, ' DWORD
type As UInteger, ' DWORD
pixels As IntPtr ' void* in/out
)
End Sub' target : DWORD
' level : INT
' format : DWORD
' type : DWORD
' pixels : void* in/out
Declare PtrSafe Sub glGetTexImage Lib "opengl32" ( _
ByVal target As Long, _
ByVal level As Long, _
ByVal format As Long, _
ByVal type As Long, _
ByVal pixels As LongPtr)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
glGetTexImage = ctypes.windll.opengl32.glGetTexImage
glGetTexImage.restype = None
glGetTexImage.argtypes = [
wintypes.DWORD, # target : DWORD
ctypes.c_int, # level : INT
wintypes.DWORD, # format : DWORD
wintypes.DWORD, # type : DWORD
ctypes.POINTER(None), # pixels : void* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('OPENGL32.dll')
glGetTexImage = Fiddle::Function.new(
lib['glGetTexImage'],
[
-Fiddle::TYPE_INT, # target : DWORD
Fiddle::TYPE_INT, # level : INT
-Fiddle::TYPE_INT, # format : DWORD
-Fiddle::TYPE_INT, # type : DWORD
Fiddle::TYPE_VOIDP, # pixels : void* in/out
],
Fiddle::TYPE_VOID)#[link(name = "opengl32")]
extern "system" {
fn glGetTexImage(
target: u32, // DWORD
level: i32, // INT
format: u32, // DWORD
type: u32, // DWORD
pixels: *mut () // void* in/out
);
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("OPENGL32.dll")]
public static extern void glGetTexImage(uint target, int level, uint format, uint type, IntPtr pixels);
"@
$api = Add-Type -MemberDefinition $sig -Name 'OPENGL32_glGetTexImage' -Namespace Win32 -PassThru
# $api::glGetTexImage(target, level, format, type, pixels)#uselib "OPENGL32.dll"
#func global glGetTexImage "glGetTexImage" sptr, sptr, sptr, sptr, sptr
; glGetTexImage target, level, format, type, pixels
; target : DWORD -> "sptr"
; level : INT -> "sptr"
; format : DWORD -> "sptr"
; type : DWORD -> "sptr"
; pixels : void* in/out -> "sptr"#uselib "OPENGL32.dll"
#func global glGetTexImage "glGetTexImage" int, int, int, int, sptr
; glGetTexImage target, level, format, type, pixels
; target : DWORD -> "int"
; level : INT -> "int"
; format : DWORD -> "int"
; type : DWORD -> "int"
; pixels : void* in/out -> "sptr"; void glGetTexImage(DWORD target, INT level, DWORD format, DWORD type, void* pixels)
#uselib "OPENGL32.dll"
#func global glGetTexImage "glGetTexImage" int, int, int, int, intptr
; glGetTexImage target, level, format, type, pixels
; target : DWORD -> "int"
; level : INT -> "int"
; format : DWORD -> "int"
; type : DWORD -> "int"
; pixels : void* in/out -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
opengl32 = windows.NewLazySystemDLL("OPENGL32.dll")
procglGetTexImage = opengl32.NewProc("glGetTexImage")
)
// target (DWORD), level (INT), format (DWORD), type (DWORD), pixels (void* in/out)
r1, _, err := procglGetTexImage.Call(
uintptr(target),
uintptr(level),
uintptr(format),
uintptr(type),
uintptr(pixels),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // voidprocedure glGetTexImage(
target: DWORD; // DWORD
level: Integer; // INT
format: DWORD; // DWORD
type: DWORD; // DWORD
pixels: Pointer // void* in/out
); stdcall;
external 'OPENGL32.dll' name 'glGetTexImage';result := DllCall("OPENGL32\glGetTexImage"
, "UInt", target ; DWORD
, "Int", level ; INT
, "UInt", format ; DWORD
, "UInt", type ; DWORD
, "Ptr", pixels ; void* in/out
, "Int") ; return: void●glGetTexImage(target, level, format, type, pixels) = DLL("OPENGL32.dll", "int glGetTexImage(dword, int, dword, dword, void*)")
# 呼び出し: glGetTexImage(target, level, format, type, pixels)
# target : DWORD -> "dword"
# level : INT -> "int"
# format : DWORD -> "dword"
# type : DWORD -> "dword"
# pixels : void* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。