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

glIndexPointer

関数
カラーインデックス頂点配列の配置を指定する。
DLLOPENGL32.dll呼出規約winapi

シグネチャ

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

void glIndexPointer(
    DWORD type,
    INT stride,
    const void* pointer
);

パラメーター

名前方向説明
typeDWORDinインデックスデータの型。GL_SHORT/GL_INT/GL_FLOAT/GL_DOUBLEなどを指定する。
strideINTin連続するインデックス間のバイト数。0なら密に詰まっているとみなす。
pointervoid*inカラーインデックス配列の先頭を指すポインタ。

戻り値の型: void

各言語での呼び出し定義

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

void glIndexPointer(
    DWORD type,
    INT stride,
    const void* pointer
);
[DllImport("OPENGL32.dll", ExactSpelling = true)]
static extern void glIndexPointer(
    uint type,   // DWORD
    int stride,   // INT
    IntPtr pointer   // void*
);
<DllImport("OPENGL32.dll", ExactSpelling:=True)>
Public Shared Sub glIndexPointer(
    type As UInteger,   ' DWORD
    stride As Integer,   ' INT
    pointer As IntPtr   ' void*
)
End Sub
' type : DWORD
' stride : INT
' pointer : void*
Declare PtrSafe Sub glIndexPointer Lib "opengl32" ( _
    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

glIndexPointer = ctypes.windll.opengl32.glIndexPointer
glIndexPointer.restype = None
glIndexPointer.argtypes = [
    wintypes.DWORD,  # type : DWORD
    ctypes.c_int,  # stride : INT
    ctypes.POINTER(None),  # pointer : void*
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('OPENGL32.dll')
glIndexPointer = Fiddle::Function.new(
  lib['glIndexPointer'],
  [
    -Fiddle::TYPE_INT,  # type : DWORD
    Fiddle::TYPE_INT,  # stride : INT
    Fiddle::TYPE_VOIDP,  # pointer : void*
  ],
  Fiddle::TYPE_VOID)
#[link(name = "opengl32")]
extern "system" {
    fn glIndexPointer(
        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 glIndexPointer(uint type, int stride, IntPtr pointer);
"@
$api = Add-Type -MemberDefinition $sig -Name 'OPENGL32_glIndexPointer' -Namespace Win32 -PassThru
# $api::glIndexPointer(type, stride, pointer)
#uselib "OPENGL32.dll"
#func global glIndexPointer "glIndexPointer" sptr, sptr, sptr
; glIndexPointer type, stride, pointer
; type : DWORD -> "sptr"
; stride : INT -> "sptr"
; pointer : void* -> "sptr"
#uselib "OPENGL32.dll"
#func global glIndexPointer "glIndexPointer" int, int, sptr
; glIndexPointer type, stride, pointer
; type : DWORD -> "int"
; stride : INT -> "int"
; pointer : void* -> "sptr"
; void glIndexPointer(DWORD type, INT stride, void* pointer)
#uselib "OPENGL32.dll"
#func global glIndexPointer "glIndexPointer" int, int, intptr
; glIndexPointer type, stride, pointer
; type : DWORD -> "int"
; stride : INT -> "int"
; pointer : void* -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	opengl32 = windows.NewLazySystemDLL("OPENGL32.dll")
	procglIndexPointer = opengl32.NewProc("glIndexPointer")
)

// type (DWORD), stride (INT), pointer (void*)
r1, _, err := procglIndexPointer.Call(
	uintptr(type),
	uintptr(stride),
	uintptr(pointer),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // void
procedure glIndexPointer(
  type: DWORD;   // DWORD
  stride: Integer;   // INT
  pointer: Pointer   // void*
); stdcall;
  external 'OPENGL32.dll' name 'glIndexPointer';
result := DllCall("OPENGL32\glIndexPointer"
    , "UInt", type   ; DWORD
    , "Int", stride   ; INT
    , "Ptr", pointer   ; void*
    , "Int")   ; return: void
●glIndexPointer(type, stride, pointer) = DLL("OPENGL32.dll", "int glIndexPointer(dword, int, void*)")
# 呼び出し: glIndexPointer(type, stride, pointer)
# 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 glIndexPointer(
    type: u32, // DWORD
    stride: i32, // INT
    pointer: ?*anyopaque // void*
) callconv(std.os.windows.WINAPI) void;
proc glIndexPointer(
    `type`: uint32,  # DWORD
    stride: int32,  # INT
    pointer: pointer  # void*
) {.importc: "glIndexPointer", stdcall, dynlib: "OPENGL32.dll".}
pragma(lib, "opengl32");
extern(Windows)
void glIndexPointer(
    uint type,   // DWORD
    int stride,   // INT
    void* pointer   // void*
);
ccall((:glIndexPointer, "OPENGL32.dll"), stdcall, Cvoid,
      (UInt32, Int32, Ptr{Cvoid}),
      type, stride, pointer)
# type : DWORD -> UInt32
# stride : INT -> Int32
# pointer : void* -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
void glIndexPointer(
    uint32_t type,
    int32_t stride,
    void* pointer);
]]
local opengl32 = ffi.load("opengl32")
-- opengl32.glIndexPointer(type, stride, pointer)
-- type : DWORD
-- stride : INT
-- pointer : void*
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('OPENGL32.dll');
const glIndexPointer = lib.func('__stdcall', 'glIndexPointer', 'void', ['uint32_t', 'int32_t', 'void *']);
// glIndexPointer(type, stride, pointer)
// type : DWORD -> 'uint32_t'
// stride : INT -> 'int32_t'
// pointer : void* -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("OPENGL32.dll", {
  glIndexPointer: { parameters: ["u32", "i32", "pointer"], result: "void" },
});
// lib.symbols.glIndexPointer(type, stride, pointer)
// type : DWORD -> "u32"
// stride : INT -> "i32"
// pointer : void* -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
void glIndexPointer(
    uint32_t type,
    int32_t stride,
    void* pointer);
C, "OPENGL32.dll");
// $ffi->glIndexPointer(type, stride, pointer);
// 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 glIndexPointer(
        int type,   // DWORD
        int stride,   // INT
        Pointer pointer   // void*
    );
}
@[Link("opengl32")]
lib LibOPENGL32
  fun glIndexPointer = glIndexPointer(
    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 glIndexPointerNative = Void Function(Uint32, Int32, Pointer<Void>);
typedef glIndexPointerDart = void Function(int, int, Pointer<Void>);
final glIndexPointer = DynamicLibrary.open('OPENGL32.dll')
    .lookupFunction<glIndexPointerNative, glIndexPointerDart>('glIndexPointer');
// type : DWORD -> Uint32
// stride : INT -> Int32
// pointer : void* -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
procedure glIndexPointer(
  type: DWORD;   // DWORD
  stride: Integer;   // INT
  pointer: Pointer   // void*
); stdcall;
  external 'OPENGL32.dll' name 'glIndexPointer';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "glIndexPointer"
  c_glIndexPointer :: Word32 -> Int32 -> Ptr () -> IO ()
-- type : DWORD -> Word32
-- stride : INT -> Int32
-- pointer : void* -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let glindexpointer =
  foreign "glIndexPointer"
    (uint32_t @-> int32_t @-> (ptr void) @-> returning void)
(* 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 ("glIndexPointer" gl-index-pointer :convention :stdcall) :void
  (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 $glIndexPointer = Win32::API::More->new('OPENGL32',
    'void glIndexPointer(DWORD type, int stride, LPVOID pointer)');
# my $ret = $glIndexPointer->Call($type, $stride, $pointer);
# type : DWORD -> DWORD
# stride : INT -> int
# pointer : void* -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。