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

glCopyTexImage2D

関数
フレームバッファから2次元テクスチャ画像へ複写する。
DLLOPENGL32.dll呼出規約winapi

シグネチャ

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

void glCopyTexImage2D(
    DWORD target,
    INT level,
    DWORD internalFormat,
    INT x,
    INT y,
    INT width,
    INT height,
    INT border
);

パラメーター

名前方向
targetDWORDin
levelINTin
internalFormatDWORDin
xINTin
yINTin
widthINTin
heightINTin
borderINTin

戻り値の型: void

各言語での呼び出し定義

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

void glCopyTexImage2D(
    DWORD target,
    INT level,
    DWORD internalFormat,
    INT x,
    INT y,
    INT width,
    INT height,
    INT border
);
[DllImport("OPENGL32.dll", ExactSpelling = true)]
static extern void glCopyTexImage2D(
    uint target,   // DWORD
    int level,   // INT
    uint internalFormat,   // DWORD
    int x,   // INT
    int y,   // INT
    int width,   // INT
    int height,   // INT
    int border   // INT
);
<DllImport("OPENGL32.dll", ExactSpelling:=True)>
Public Shared Sub glCopyTexImage2D(
    target As UInteger,   ' DWORD
    level As Integer,   ' INT
    internalFormat As UInteger,   ' DWORD
    x As Integer,   ' INT
    y As Integer,   ' INT
    width As Integer,   ' INT
    height As Integer,   ' INT
    border As Integer   ' INT
)
End Sub
' target : DWORD
' level : INT
' internalFormat : DWORD
' x : INT
' y : INT
' width : INT
' height : INT
' border : INT
Declare PtrSafe Sub glCopyTexImage2D Lib "opengl32" ( _
    ByVal target As Long, _
    ByVal level As Long, _
    ByVal internalFormat As Long, _
    ByVal x As Long, _
    ByVal y As Long, _
    ByVal width As Long, _
    ByVal height As Long, _
    ByVal border As Long)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

glCopyTexImage2D = ctypes.windll.opengl32.glCopyTexImage2D
glCopyTexImage2D.restype = None
glCopyTexImage2D.argtypes = [
    wintypes.DWORD,  # target : DWORD
    ctypes.c_int,  # level : INT
    wintypes.DWORD,  # internalFormat : DWORD
    ctypes.c_int,  # x : INT
    ctypes.c_int,  # y : INT
    ctypes.c_int,  # width : INT
    ctypes.c_int,  # height : INT
    ctypes.c_int,  # border : INT
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('OPENGL32.dll')
glCopyTexImage2D = Fiddle::Function.new(
  lib['glCopyTexImage2D'],
  [
    -Fiddle::TYPE_INT,  # target : DWORD
    Fiddle::TYPE_INT,  # level : INT
    -Fiddle::TYPE_INT,  # internalFormat : DWORD
    Fiddle::TYPE_INT,  # x : INT
    Fiddle::TYPE_INT,  # y : INT
    Fiddle::TYPE_INT,  # width : INT
    Fiddle::TYPE_INT,  # height : INT
    Fiddle::TYPE_INT,  # border : INT
  ],
  Fiddle::TYPE_VOID)
#[link(name = "opengl32")]
extern "system" {
    fn glCopyTexImage2D(
        target: u32,  // DWORD
        level: i32,  // INT
        internalFormat: u32,  // DWORD
        x: i32,  // INT
        y: i32,  // INT
        width: i32,  // INT
        height: i32,  // INT
        border: i32  // INT
    );
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("OPENGL32.dll")]
public static extern void glCopyTexImage2D(uint target, int level, uint internalFormat, int x, int y, int width, int height, int border);
"@
$api = Add-Type -MemberDefinition $sig -Name 'OPENGL32_glCopyTexImage2D' -Namespace Win32 -PassThru
# $api::glCopyTexImage2D(target, level, internalFormat, x, y, width, height, border)
#uselib "OPENGL32.dll"
#func global glCopyTexImage2D "glCopyTexImage2D" sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr
; glCopyTexImage2D target, level, internalFormat, x, y, width, height, border
; target : DWORD -> "sptr"
; level : INT -> "sptr"
; internalFormat : DWORD -> "sptr"
; x : INT -> "sptr"
; y : INT -> "sptr"
; width : INT -> "sptr"
; height : INT -> "sptr"
; border : INT -> "sptr"
#uselib "OPENGL32.dll"
#func global glCopyTexImage2D "glCopyTexImage2D" int, int, int, int, int, int, int, int
; glCopyTexImage2D target, level, internalFormat, x, y, width, height, border
; target : DWORD -> "int"
; level : INT -> "int"
; internalFormat : DWORD -> "int"
; x : INT -> "int"
; y : INT -> "int"
; width : INT -> "int"
; height : INT -> "int"
; border : INT -> "int"
; void glCopyTexImage2D(DWORD target, INT level, DWORD internalFormat, INT x, INT y, INT width, INT height, INT border)
#uselib "OPENGL32.dll"
#func global glCopyTexImage2D "glCopyTexImage2D" int, int, int, int, int, int, int, int
; glCopyTexImage2D target, level, internalFormat, x, y, width, height, border
; target : DWORD -> "int"
; level : INT -> "int"
; internalFormat : DWORD -> "int"
; x : INT -> "int"
; y : INT -> "int"
; width : INT -> "int"
; height : INT -> "int"
; border : INT -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	opengl32 = windows.NewLazySystemDLL("OPENGL32.dll")
	procglCopyTexImage2D = opengl32.NewProc("glCopyTexImage2D")
)

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