ホーム › Graphics.OpenGL › glMap1d
glMap1d
関数1次元エバリュエータの倍精度制御点を定義する。
シグネチャ
// OPENGL32.dll
#include <windows.h>
void glMap1d(
DWORD target,
DOUBLE u1,
DOUBLE u2,
INT stride,
INT order,
const DOUBLE* points
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| target | DWORD | in | 生成する1次元エバリュエータの種類。GL_MAP1_VERTEX_3やGL_MAP1_COLOR_4などを指定する。 |
| u1 | DOUBLE | in | パラメータuの定義域の下限値。倍精度で指定する。 |
| u2 | DOUBLE | in | パラメータuの定義域の上限値。倍精度で指定する。 |
| stride | INT | in | 制御点配列内で隣接する点までの浮動小数点数のオフセット。要素間の間隔を表す。 |
| order | INT | in | 制御点の数(次数+1)。1以上GL_MAX_EVAL_ORDER以下である。 |
| points | DOUBLE* | in | 制御点データへのポインタ。order個の点を保持する倍精度配列を指す。 |
戻り値の型: void
各言語での呼び出し定義
// OPENGL32.dll
#include <windows.h>
void glMap1d(
DWORD target,
DOUBLE u1,
DOUBLE u2,
INT stride,
INT order,
const DOUBLE* points
);[DllImport("OPENGL32.dll", ExactSpelling = true)]
static extern void glMap1d(
uint target, // DWORD
double u1, // DOUBLE
double u2, // DOUBLE
int stride, // INT
int order, // INT
ref double points // DOUBLE*
);<DllImport("OPENGL32.dll", ExactSpelling:=True)>
Public Shared Sub glMap1d(
target As UInteger, ' DWORD
u1 As Double, ' DOUBLE
u2 As Double, ' DOUBLE
stride As Integer, ' INT
order As Integer, ' INT
ByRef points As Double ' DOUBLE*
)
End Sub' target : DWORD
' u1 : DOUBLE
' u2 : DOUBLE
' stride : INT
' order : INT
' points : DOUBLE*
Declare PtrSafe Sub glMap1d Lib "opengl32" ( _
ByVal target As Long, _
ByVal u1 As Double, _
ByVal u2 As Double, _
ByVal stride As Long, _
ByVal order As Long, _
ByRef points As Double)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
glMap1d = ctypes.windll.opengl32.glMap1d
glMap1d.restype = None
glMap1d.argtypes = [
wintypes.DWORD, # target : DWORD
ctypes.c_double, # u1 : DOUBLE
ctypes.c_double, # u2 : DOUBLE
ctypes.c_int, # stride : INT
ctypes.c_int, # order : INT
ctypes.POINTER(ctypes.c_double), # points : DOUBLE*
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('OPENGL32.dll')
glMap1d = Fiddle::Function.new(
lib['glMap1d'],
[
-Fiddle::TYPE_INT, # target : DWORD
Fiddle::TYPE_DOUBLE, # u1 : DOUBLE
Fiddle::TYPE_DOUBLE, # u2 : DOUBLE
Fiddle::TYPE_INT, # stride : INT
Fiddle::TYPE_INT, # order : INT
Fiddle::TYPE_VOIDP, # points : DOUBLE*
],
Fiddle::TYPE_VOID)#[link(name = "opengl32")]
extern "system" {
fn glMap1d(
target: u32, // DWORD
u1: f64, // DOUBLE
u2: f64, // DOUBLE
stride: i32, // INT
order: i32, // INT
points: *const f64 // DOUBLE*
);
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("OPENGL32.dll")]
public static extern void glMap1d(uint target, double u1, double u2, int stride, int order, ref double points);
"@
$api = Add-Type -MemberDefinition $sig -Name 'OPENGL32_glMap1d' -Namespace Win32 -PassThru
# $api::glMap1d(target, u1, u2, stride, order, points)#uselib "OPENGL32.dll"
#func global glMap1d "glMap1d" sptr, double, double, sptr, sptr, sptr
; glMap1d target, u1, u2, stride, order, varptr(points)
; target : DWORD -> "sptr"
; u1 : DOUBLE -> "double"
; u2 : DOUBLE -> "double"
; stride : INT -> "sptr"
; order : INT -> "sptr"
; points : DOUBLE* -> "sptr"出力引数:
#uselib "OPENGL32.dll" #func global glMap1d "glMap1d" int, double, double, int, int, var ; glMap1d target, u1, u2, stride, order, points ; target : DWORD -> "int" ; u1 : DOUBLE -> "double" ; u2 : DOUBLE -> "double" ; stride : INT -> "int" ; order : INT -> "int" ; points : DOUBLE* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "OPENGL32.dll" #func global glMap1d "glMap1d" int, double, double, int, int, sptr ; glMap1d target, u1, u2, stride, order, varptr(points) ; target : DWORD -> "int" ; u1 : DOUBLE -> "double" ; u2 : DOUBLE -> "double" ; stride : INT -> "int" ; order : INT -> "int" ; points : DOUBLE* -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; void glMap1d(DWORD target, DOUBLE u1, DOUBLE u2, INT stride, INT order, DOUBLE* points) #uselib "OPENGL32.dll" #func global glMap1d "glMap1d" int, double, double, int, int, var ; glMap1d target, u1, u2, stride, order, points ; target : DWORD -> "int" ; u1 : DOUBLE -> "double" ; u2 : DOUBLE -> "double" ; stride : INT -> "int" ; order : INT -> "int" ; points : DOUBLE* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; void glMap1d(DWORD target, DOUBLE u1, DOUBLE u2, INT stride, INT order, DOUBLE* points) #uselib "OPENGL32.dll" #func global glMap1d "glMap1d" int, double, double, int, int, intptr ; glMap1d target, u1, u2, stride, order, varptr(points) ; target : DWORD -> "int" ; u1 : DOUBLE -> "double" ; u2 : DOUBLE -> "double" ; stride : INT -> "int" ; order : INT -> "int" ; points : DOUBLE* -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"math"
"golang.org/x/sys/windows"
"unsafe"
)
var (
opengl32 = windows.NewLazySystemDLL("OPENGL32.dll")
procglMap1d = opengl32.NewProc("glMap1d")
)
// target (DWORD), u1 (DOUBLE), u2 (DOUBLE), stride (INT), order (INT), points (DOUBLE*)
r1, _, err := procglMap1d.Call(
uintptr(target),
uintptr(math.Float64bits(u1)),
uintptr(math.Float64bits(u2)),
uintptr(stride),
uintptr(order),
uintptr(points),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // void
// 注意: float/double 引数は proc.Call では XMM レジスタに渡せません。
// windows.SyscallN(proc.Addr(), math.Float64bits(x), ...) もしくは cgo を使用してください。procedure glMap1d(
target: DWORD; // DWORD
u1: Double; // DOUBLE
u2: Double; // DOUBLE
stride: Integer; // INT
order: Integer; // INT
points: Pointer // DOUBLE*
); stdcall;
external 'OPENGL32.dll' name 'glMap1d';result := DllCall("OPENGL32\glMap1d"
, "UInt", target ; DWORD
, "Double", u1 ; DOUBLE
, "Double", u2 ; DOUBLE
, "Int", stride ; INT
, "Int", order ; INT
, "Ptr", points ; DOUBLE*
, "Int") ; return: void●glMap1d(target, u1, u2, stride, order, points) = DLL("OPENGL32.dll", "int glMap1d(dword, double, double, int, int, void*)")
# 呼び出し: glMap1d(target, u1, u2, stride, order, points)
# target : DWORD -> "dword"
# u1 : DOUBLE -> "double"
# u2 : DOUBLE -> "double"
# stride : INT -> "int"
# order : INT -> "int"
# points : DOUBLE* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "opengl32" fn glMap1d(
target: u32, // DWORD
u1: f64, // DOUBLE
u2: f64, // DOUBLE
stride: i32, // INT
order: i32, // INT
points: [*c]f64 // DOUBLE*
) callconv(std.os.windows.WINAPI) void;proc glMap1d(
target: uint32, # DWORD
u1: float64, # DOUBLE
u2: float64, # DOUBLE
stride: int32, # INT
order: int32, # INT
points: ptr float64 # DOUBLE*
) {.importc: "glMap1d", stdcall, dynlib: "OPENGL32.dll".}pragma(lib, "opengl32");
extern(Windows)
void glMap1d(
uint target, // DWORD
double u1, // DOUBLE
double u2, // DOUBLE
int stride, // INT
int order, // INT
double* points // DOUBLE*
);ccall((:glMap1d, "OPENGL32.dll"), stdcall, Cvoid,
(UInt32, Float64, Float64, Int32, Int32, Ptr{Float64}),
target, u1, u2, stride, order, points)
# target : DWORD -> UInt32
# u1 : DOUBLE -> Float64
# u2 : DOUBLE -> Float64
# stride : INT -> Int32
# order : INT -> Int32
# points : DOUBLE* -> Ptr{Float64}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
void glMap1d(
uint32_t target,
double u1,
double u2,
int32_t stride,
int32_t order,
double* points);
]]
local opengl32 = ffi.load("opengl32")
-- opengl32.glMap1d(target, u1, u2, stride, order, points)
-- target : DWORD
-- u1 : DOUBLE
-- u2 : DOUBLE
-- stride : INT
-- order : INT
-- points : DOUBLE*
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('OPENGL32.dll');
const glMap1d = lib.func('__stdcall', 'glMap1d', 'void', ['uint32_t', 'double', 'double', 'int32_t', 'int32_t', 'double *']);
// glMap1d(target, u1, u2, stride, order, points)
// target : DWORD -> 'uint32_t'
// u1 : DOUBLE -> 'double'
// u2 : DOUBLE -> 'double'
// stride : INT -> 'int32_t'
// order : INT -> 'int32_t'
// points : DOUBLE* -> 'double *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("OPENGL32.dll", {
glMap1d: { parameters: ["u32", "f64", "f64", "i32", "i32", "pointer"], result: "void" },
});
// lib.symbols.glMap1d(target, u1, u2, stride, order, points)
// target : DWORD -> "u32"
// u1 : DOUBLE -> "f64"
// u2 : DOUBLE -> "f64"
// stride : INT -> "i32"
// order : INT -> "i32"
// points : DOUBLE* -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
void glMap1d(
uint32_t target,
double u1,
double u2,
int32_t stride,
int32_t order,
double* points);
C, "OPENGL32.dll");
// $ffi->glMap1d(target, u1, u2, stride, order, points);
// target : DWORD
// u1 : DOUBLE
// u2 : DOUBLE
// stride : INT
// order : INT
// points : DOUBLE*
// 構造体/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 glMap1d(
int target, // DWORD
double u1, // DOUBLE
double u2, // DOUBLE
int stride, // INT
int order, // INT
DoubleByReference points // DOUBLE*
);
}@[Link("opengl32")]
lib LibOPENGL32
fun glMap1d = glMap1d(
target : UInt32, # DWORD
u1 : Float64, # DOUBLE
u2 : Float64, # DOUBLE
stride : Int32, # INT
order : Int32, # INT
points : Float64* # DOUBLE*
) : Void
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef glMap1dNative = Void Function(Uint32, Double, Double, Int32, Int32, Pointer<Double>);
typedef glMap1dDart = void Function(int, double, double, int, int, Pointer<Double>);
final glMap1d = DynamicLibrary.open('OPENGL32.dll')
.lookupFunction<glMap1dNative, glMap1dDart>('glMap1d');
// target : DWORD -> Uint32
// u1 : DOUBLE -> Double
// u2 : DOUBLE -> Double
// stride : INT -> Int32
// order : INT -> Int32
// points : DOUBLE* -> Pointer<Double>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
procedure glMap1d(
target: DWORD; // DWORD
u1: Double; // DOUBLE
u2: Double; // DOUBLE
stride: Integer; // INT
order: Integer; // INT
points: Pointer // DOUBLE*
); stdcall;
external 'OPENGL32.dll' name 'glMap1d';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "glMap1d"
c_glMap1d :: Word32 -> CDouble -> CDouble -> Int32 -> Int32 -> Ptr CDouble -> IO ()
-- target : DWORD -> Word32
-- u1 : DOUBLE -> CDouble
-- u2 : DOUBLE -> CDouble
-- stride : INT -> Int32
-- order : INT -> Int32
-- points : DOUBLE* -> Ptr CDouble
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let glmap1d =
foreign "glMap1d"
(uint32_t @-> double @-> double @-> int32_t @-> int32_t @-> (ptr double) @-> returning void)
(* target : DWORD -> uint32_t *)
(* u1 : DOUBLE -> double *)
(* u2 : DOUBLE -> double *)
(* stride : INT -> int32_t *)
(* order : INT -> int32_t *)
(* points : DOUBLE* -> (ptr double) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library opengl32 (t "OPENGL32.dll"))
(cffi:use-foreign-library opengl32)
(cffi:defcfun ("glMap1d" gl-map1d :convention :stdcall) :void
(target :uint32) ; DWORD
(u1 :double) ; DOUBLE
(u2 :double) ; DOUBLE
(stride :int32) ; INT
(order :int32) ; INT
(points :pointer)) ; DOUBLE*
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $glMap1d = Win32::API::More->new('OPENGL32',
'void glMap1d(DWORD target, double u1, double u2, int stride, int order, LPVOID points)');
# my $ret = $glMap1d->Call($target, $u1, $u2, $stride, $order, $points);
# target : DWORD -> DWORD
# u1 : DOUBLE -> double
# u2 : DOUBLE -> double
# stride : INT -> int
# order : INT -> int
# points : DOUBLE* -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。