ホーム › Graphics.OpenGL › glCallLists
glCallLists
関数複数の表示リストをまとめて実行する。
シグネチャ
// OPENGL32.dll
#include <windows.h>
void glCallLists(
INT n,
DWORD type,
const void* lists
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| n | INT | in | 実行する表示リストの個数を示すINT値。 |
| type | DWORD | in | lists配列の要素のデータ型を示すDWORD列挙値(GL_UNSIGNED_BYTE等)。 |
| lists | void* | in | 実行する表示リスト番号(オフセット)を格納した配列へのポインタ。 |
戻り値の型: void
各言語での呼び出し定義
// OPENGL32.dll
#include <windows.h>
void glCallLists(
INT n,
DWORD type,
const void* lists
);[DllImport("OPENGL32.dll", ExactSpelling = true)]
static extern void glCallLists(
int n, // INT
uint type, // DWORD
IntPtr lists // void*
);<DllImport("OPENGL32.dll", ExactSpelling:=True)>
Public Shared Sub glCallLists(
n As Integer, ' INT
type As UInteger, ' DWORD
lists As IntPtr ' void*
)
End Sub' n : INT
' type : DWORD
' lists : void*
Declare PtrSafe Sub glCallLists Lib "opengl32" ( _
ByVal n As Long, _
ByVal type As Long, _
ByVal lists As LongPtr)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
glCallLists = ctypes.windll.opengl32.glCallLists
glCallLists.restype = None
glCallLists.argtypes = [
ctypes.c_int, # n : INT
wintypes.DWORD, # type : DWORD
ctypes.POINTER(None), # lists : void*
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('OPENGL32.dll')
glCallLists = Fiddle::Function.new(
lib['glCallLists'],
[
Fiddle::TYPE_INT, # n : INT
-Fiddle::TYPE_INT, # type : DWORD
Fiddle::TYPE_VOIDP, # lists : void*
],
Fiddle::TYPE_VOID)#[link(name = "opengl32")]
extern "system" {
fn glCallLists(
n: i32, // INT
type: u32, // DWORD
lists: *const () // void*
);
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("OPENGL32.dll")]
public static extern void glCallLists(int n, uint type, IntPtr lists);
"@
$api = Add-Type -MemberDefinition $sig -Name 'OPENGL32_glCallLists' -Namespace Win32 -PassThru
# $api::glCallLists(n, type, lists)#uselib "OPENGL32.dll"
#func global glCallLists "glCallLists" sptr, sptr, sptr
; glCallLists n, type, lists
; n : INT -> "sptr"
; type : DWORD -> "sptr"
; lists : void* -> "sptr"#uselib "OPENGL32.dll"
#func global glCallLists "glCallLists" int, int, sptr
; glCallLists n, type, lists
; n : INT -> "int"
; type : DWORD -> "int"
; lists : void* -> "sptr"; void glCallLists(INT n, DWORD type, void* lists)
#uselib "OPENGL32.dll"
#func global glCallLists "glCallLists" int, int, intptr
; glCallLists n, type, lists
; n : INT -> "int"
; type : DWORD -> "int"
; lists : void* -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
opengl32 = windows.NewLazySystemDLL("OPENGL32.dll")
procglCallLists = opengl32.NewProc("glCallLists")
)
// n (INT), type (DWORD), lists (void*)
r1, _, err := procglCallLists.Call(
uintptr(n),
uintptr(type),
uintptr(lists),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // voidprocedure glCallLists(
n: Integer; // INT
type: DWORD; // DWORD
lists: Pointer // void*
); stdcall;
external 'OPENGL32.dll' name 'glCallLists';result := DllCall("OPENGL32\glCallLists"
, "Int", n ; INT
, "UInt", type ; DWORD
, "Ptr", lists ; void*
, "Int") ; return: void●glCallLists(n, type, lists) = DLL("OPENGL32.dll", "int glCallLists(int, dword, void*)")
# 呼び出し: glCallLists(n, type, lists)
# n : INT -> "int"
# type : DWORD -> "dword"
# lists : void* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "opengl32" fn glCallLists(
n: i32, // INT
type: u32, // DWORD
lists: ?*anyopaque // void*
) callconv(std.os.windows.WINAPI) void;proc glCallLists(
n: int32, # INT
`type`: uint32, # DWORD
lists: pointer # void*
) {.importc: "glCallLists", stdcall, dynlib: "OPENGL32.dll".}pragma(lib, "opengl32");
extern(Windows)
void glCallLists(
int n, // INT
uint type, // DWORD
void* lists // void*
);ccall((:glCallLists, "OPENGL32.dll"), stdcall, Cvoid,
(Int32, UInt32, Ptr{Cvoid}),
n, type, lists)
# n : INT -> Int32
# type : DWORD -> UInt32
# lists : void* -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
void glCallLists(
int32_t n,
uint32_t type,
void* lists);
]]
local opengl32 = ffi.load("opengl32")
-- opengl32.glCallLists(n, type, lists)
-- n : INT
-- type : DWORD
-- lists : void*
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('OPENGL32.dll');
const glCallLists = lib.func('__stdcall', 'glCallLists', 'void', ['int32_t', 'uint32_t', 'void *']);
// glCallLists(n, type, lists)
// n : INT -> 'int32_t'
// type : DWORD -> 'uint32_t'
// lists : void* -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("OPENGL32.dll", {
glCallLists: { parameters: ["i32", "u32", "pointer"], result: "void" },
});
// lib.symbols.glCallLists(n, type, lists)
// n : INT -> "i32"
// type : DWORD -> "u32"
// lists : void* -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
void glCallLists(
int32_t n,
uint32_t type,
void* lists);
C, "OPENGL32.dll");
// $ffi->glCallLists(n, type, lists);
// n : INT
// type : DWORD
// lists : 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 glCallLists(
int n, // INT
int type, // DWORD
Pointer lists // void*
);
}@[Link("opengl32")]
lib LibOPENGL32
fun glCallLists = glCallLists(
n : Int32, # INT
type_ : UInt32, # DWORD
lists : 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 glCallListsNative = Void Function(Int32, Uint32, Pointer<Void>);
typedef glCallListsDart = void Function(int, int, Pointer<Void>);
final glCallLists = DynamicLibrary.open('OPENGL32.dll')
.lookupFunction<glCallListsNative, glCallListsDart>('glCallLists');
// n : INT -> Int32
// type : DWORD -> Uint32
// lists : void* -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
procedure glCallLists(
n: Integer; // INT
type: DWORD; // DWORD
lists: Pointer // void*
); stdcall;
external 'OPENGL32.dll' name 'glCallLists';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "glCallLists"
c_glCallLists :: Int32 -> Word32 -> Ptr () -> IO ()
-- n : INT -> Int32
-- type : DWORD -> Word32
-- lists : void* -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let glcalllists =
foreign "glCallLists"
(int32_t @-> uint32_t @-> (ptr void) @-> returning void)
(* n : INT -> int32_t *)
(* type : DWORD -> uint32_t *)
(* lists : 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 ("glCallLists" gl-call-lists :convention :stdcall) :void
(n :int32) ; INT
(type :uint32) ; DWORD
(lists :pointer)) ; void*
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $glCallLists = Win32::API::More->new('OPENGL32',
'void glCallLists(int n, DWORD type, LPVOID lists)');
# my $ret = $glCallLists->Call($n, $type, $lists);
# n : INT -> int
# type : DWORD -> DWORD
# lists : void* -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。