glTexCoordPointer
関数シグネチャ
// OPENGL32.dll
#include <windows.h>
void glTexCoordPointer(
INT size,
DWORD type,
INT stride,
const void* pointer
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| size | INT | in | 頂点あたりのテクスチャ座標成分数。1,2,3,4のいずれか。 |
| type | DWORD | in | 各座標のデータ型。GL_SHORT/GL_INT/GL_FLOAT/GL_DOUBLEなど。 |
| stride | INT | in | 連続する座標間のバイト間隔。0なら密に詰まっているとみなす。 |
| pointer | void* | in | テクスチャ座標配列の先頭を指すポインタ。 |
戻り値の型: void
公式ドキュメント
glTexCoordPointer 関数は、テクスチャ座標の配列を定義します。
戻り値
この関数は値を返しません。
解説(Remarks)
glTexCoordPointer 関数は、レンダリング時に使用するテクスチャ座標配列の位置とデータを指定します。size パラメーターは、配列の各要素に使用する座標の数を指定します。type パラメーターは、各テクスチャ座標のデータ型を指定します。stride パラメーターは、ある配列要素から次の配列要素までのバイトオフセットを決定します。これにより、頂点と属性を単一の配列にまとめて格納したり、別々の配列に格納したりできます。実装によっては、頂点と属性を単一の配列に格納するほうが、別々の配列を使用するよりも効率的な場合があります。詳細については、glInterleavedArrays を参照してください。テクスチャ座標配列を指定すると、size、type、stride、pointer はクライアント側の状態として保存されます。
テクスチャ座標配列は、glEnableClientState に GL_TEXTURE_COORD_ARRAY 定数を指定することで有効になります。有効な場合、glDrawArrays、glDrawElements、および glArrayElement はテクスチャ座標配列を使用します。既定では、テクスチャ座標配列は無効です。
glTexCoordPointer をディスプレイリストに含めることはできません。
glTexCoordPointer でテクスチャ座標配列を指定すると、この関数のテクスチャ座標配列パラメーターの値はすべてクライアント側の状態に保存され、静的な配列要素はキャッシュされることがあります。テクスチャ座標配列パラメーターはクライアント側の状態であるため、それらの値は glPushAttrib および glPopAttrib によって保存も復元もされません。
glBegin と glEnd のペアの内部で glTexCoordPointer を呼び出してもエラーは発生しませんが、結果は未定義です。
次の関数は、glTexCoordPointer に関連する情報を取得します。
引数 GL_TEXTURE_COORD_ARRAY を指定した glIsEnabled
引数 GL_TEXTURE_COORD_ARRAY_SIZE を指定した glGet
引数 GL_TEXTURE_COORD_ARRAY_STRIDE を指定した glGet
引数 GL_TEXTURE_COORD_ARRAY_COUNT を指定した glGet
引数 GL_TEXTURE_COORD_ARRAY_TYPE を指定した glGet
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp)
各言語での呼び出し定義
// OPENGL32.dll
#include <windows.h>
void glTexCoordPointer(
INT size,
DWORD type,
INT stride,
const void* pointer
);[DllImport("OPENGL32.dll", ExactSpelling = true)]
static extern void glTexCoordPointer(
int size, // INT
uint type, // DWORD
int stride, // INT
IntPtr pointer // void*
);<DllImport("OPENGL32.dll", ExactSpelling:=True)>
Public Shared Sub glTexCoordPointer(
size As Integer, ' INT
type As UInteger, ' DWORD
stride As Integer, ' INT
pointer As IntPtr ' void*
)
End Sub' size : INT
' type : DWORD
' stride : INT
' pointer : void*
Declare PtrSafe Sub glTexCoordPointer Lib "opengl32" ( _
ByVal size As Long, _
ByVal type As Long, _
ByVal stride As Long, _
ByVal pointer As LongPtr)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
glTexCoordPointer = ctypes.windll.opengl32.glTexCoordPointer
glTexCoordPointer.restype = None
glTexCoordPointer.argtypes = [
ctypes.c_int, # size : INT
wintypes.DWORD, # type : DWORD
ctypes.c_int, # stride : INT
ctypes.POINTER(None), # pointer : void*
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('OPENGL32.dll')
glTexCoordPointer = Fiddle::Function.new(
lib['glTexCoordPointer'],
[
Fiddle::TYPE_INT, # size : INT
-Fiddle::TYPE_INT, # type : DWORD
Fiddle::TYPE_INT, # stride : INT
Fiddle::TYPE_VOIDP, # pointer : void*
],
Fiddle::TYPE_VOID)#[link(name = "opengl32")]
extern "system" {
fn glTexCoordPointer(
size: i32, // INT
type: u32, // DWORD
stride: i32, // INT
pointer: *const () // void*
);
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("OPENGL32.dll")]
public static extern void glTexCoordPointer(int size, uint type, int stride, IntPtr pointer);
"@
$api = Add-Type -MemberDefinition $sig -Name 'OPENGL32_glTexCoordPointer' -Namespace Win32 -PassThru
# $api::glTexCoordPointer(size, type, stride, pointer)#uselib "OPENGL32.dll"
#func global glTexCoordPointer "glTexCoordPointer" sptr, sptr, sptr, sptr
; glTexCoordPointer size, type, stride, pointer
; size : INT -> "sptr"
; type : DWORD -> "sptr"
; stride : INT -> "sptr"
; pointer : void* -> "sptr"#uselib "OPENGL32.dll"
#func global glTexCoordPointer "glTexCoordPointer" int, int, int, sptr
; glTexCoordPointer size, type, stride, pointer
; size : INT -> "int"
; type : DWORD -> "int"
; stride : INT -> "int"
; pointer : void* -> "sptr"; void glTexCoordPointer(INT size, DWORD type, INT stride, void* pointer)
#uselib "OPENGL32.dll"
#func global glTexCoordPointer "glTexCoordPointer" int, int, int, intptr
; glTexCoordPointer size, type, stride, pointer
; size : INT -> "int"
; type : DWORD -> "int"
; stride : INT -> "int"
; pointer : void* -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
opengl32 = windows.NewLazySystemDLL("OPENGL32.dll")
procglTexCoordPointer = opengl32.NewProc("glTexCoordPointer")
)
// size (INT), type (DWORD), stride (INT), pointer (void*)
r1, _, err := procglTexCoordPointer.Call(
uintptr(size),
uintptr(type),
uintptr(stride),
uintptr(pointer),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // voidprocedure glTexCoordPointer(
size: Integer; // INT
type: DWORD; // DWORD
stride: Integer; // INT
pointer: Pointer // void*
); stdcall;
external 'OPENGL32.dll' name 'glTexCoordPointer';result := DllCall("OPENGL32\glTexCoordPointer"
, "Int", size ; INT
, "UInt", type ; DWORD
, "Int", stride ; INT
, "Ptr", pointer ; void*
, "Int") ; return: void●glTexCoordPointer(size, type, stride, pointer) = DLL("OPENGL32.dll", "int glTexCoordPointer(int, dword, int, void*)")
# 呼び出し: glTexCoordPointer(size, type, stride, pointer)
# size : INT -> "int"
# type : DWORD -> "dword"
# stride : INT -> "int"
# pointer : void* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "opengl32" fn glTexCoordPointer(
size: i32, // INT
type: u32, // DWORD
stride: i32, // INT
pointer: ?*anyopaque // void*
) callconv(std.os.windows.WINAPI) void;proc glTexCoordPointer(
size: int32, # INT
`type`: uint32, # DWORD
stride: int32, # INT
pointer: pointer # void*
) {.importc: "glTexCoordPointer", stdcall, dynlib: "OPENGL32.dll".}pragma(lib, "opengl32");
extern(Windows)
void glTexCoordPointer(
int size, // INT
uint type, // DWORD
int stride, // INT
void* pointer // void*
);ccall((:glTexCoordPointer, "OPENGL32.dll"), stdcall, Cvoid,
(Int32, UInt32, Int32, Ptr{Cvoid}),
size, type, stride, pointer)
# size : INT -> Int32
# type : DWORD -> UInt32
# stride : INT -> Int32
# pointer : void* -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
void glTexCoordPointer(
int32_t size,
uint32_t type,
int32_t stride,
void* pointer);
]]
local opengl32 = ffi.load("opengl32")
-- opengl32.glTexCoordPointer(size, type, stride, pointer)
-- size : INT
-- type : DWORD
-- stride : INT
-- pointer : void*
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('OPENGL32.dll');
const glTexCoordPointer = lib.func('__stdcall', 'glTexCoordPointer', 'void', ['int32_t', 'uint32_t', 'int32_t', 'void *']);
// glTexCoordPointer(size, type, stride, pointer)
// size : INT -> 'int32_t'
// type : DWORD -> 'uint32_t'
// stride : INT -> 'int32_t'
// pointer : void* -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("OPENGL32.dll", {
glTexCoordPointer: { parameters: ["i32", "u32", "i32", "pointer"], result: "void" },
});
// lib.symbols.glTexCoordPointer(size, type, stride, pointer)
// size : INT -> "i32"
// type : DWORD -> "u32"
// stride : INT -> "i32"
// pointer : void* -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
void glTexCoordPointer(
int32_t size,
uint32_t type,
int32_t stride,
void* pointer);
C, "OPENGL32.dll");
// $ffi->glTexCoordPointer(size, type, stride, pointer);
// size : INT
// type : DWORD
// stride : INT
// pointer : 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 Opengl32 extends StdCallLibrary {
Opengl32 INSTANCE = Native.load("opengl32", Opengl32.class);
void glTexCoordPointer(
int size, // INT
int type, // DWORD
int stride, // INT
Pointer pointer // void*
);
}@[Link("opengl32")]
lib LibOPENGL32
fun glTexCoordPointer = glTexCoordPointer(
size : Int32, # INT
type_ : UInt32, # DWORD
stride : Int32, # INT
pointer : Void* # void*
) : Void
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef glTexCoordPointerNative = Void Function(Int32, Uint32, Int32, Pointer<Void>);
typedef glTexCoordPointerDart = void Function(int, int, int, Pointer<Void>);
final glTexCoordPointer = DynamicLibrary.open('OPENGL32.dll')
.lookupFunction<glTexCoordPointerNative, glTexCoordPointerDart>('glTexCoordPointer');
// size : INT -> Int32
// type : DWORD -> Uint32
// stride : INT -> Int32
// pointer : void* -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
procedure glTexCoordPointer(
size: Integer; // INT
type: DWORD; // DWORD
stride: Integer; // INT
pointer: Pointer // void*
); stdcall;
external 'OPENGL32.dll' name 'glTexCoordPointer';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "glTexCoordPointer"
c_glTexCoordPointer :: Int32 -> Word32 -> Int32 -> Ptr () -> IO ()
-- size : INT -> Int32
-- type : DWORD -> Word32
-- stride : INT -> Int32
-- pointer : void* -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let gltexcoordpointer =
foreign "glTexCoordPointer"
(int32_t @-> uint32_t @-> int32_t @-> (ptr void) @-> returning void)
(* size : INT -> int32_t *)
(* type : DWORD -> uint32_t *)
(* stride : INT -> int32_t *)
(* pointer : void* -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library opengl32 (t "OPENGL32.dll"))
(cffi:use-foreign-library opengl32)
(cffi:defcfun ("glTexCoordPointer" gl-tex-coord-pointer :convention :stdcall) :void
(size :int32) ; INT
(type :uint32) ; DWORD
(stride :int32) ; INT
(pointer :pointer)) ; void*
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $glTexCoordPointer = Win32::API::More->new('OPENGL32',
'void glTexCoordPointer(int size, DWORD type, int stride, LPVOID pointer)');
# my $ret = $glTexCoordPointer->Call($size, $type, $stride, $pointer);
# size : INT -> int
# type : DWORD -> DWORD
# stride : INT -> int
# pointer : void* -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。