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