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

glMap1f

関数
1次元エバリュエータの単精度制御点を定義する。
DLLOPENGL32.dll呼出規約winapi

シグネチャ

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

void glMap1f(
    DWORD target,
    FLOAT u1,
    FLOAT u2,
    INT stride,
    INT order,
    const FLOAT* points
);

パラメーター

名前方向説明
targetDWORDin生成する1次元エバリュエータの種類。GL_MAP1_VERTEX_3やGL_MAP1_COLOR_4などを指定する。
u1FLOATinパラメータuの定義域の下限値。単精度で指定する。
u2FLOATinパラメータuの定義域の上限値。単精度で指定する。
strideINTin制御点配列内で隣接する点までの浮動小数点数のオフセット。要素間の間隔を表す。
orderINTin制御点の数(次数+1)。1以上GL_MAX_EVAL_ORDER以下である。
pointsFLOAT*in制御点データへのポインタ。order個の点を保持する単精度配列を指す。

戻り値の型: void

各言語での呼び出し定義

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

void glMap1f(
    DWORD target,
    FLOAT u1,
    FLOAT u2,
    INT stride,
    INT order,
    const FLOAT* points
);
[DllImport("OPENGL32.dll", ExactSpelling = true)]
static extern void glMap1f(
    uint target,   // DWORD
    float u1,   // FLOAT
    float u2,   // FLOAT
    int stride,   // INT
    int order,   // INT
    ref float points   // FLOAT*
);
<DllImport("OPENGL32.dll", ExactSpelling:=True)>
Public Shared Sub glMap1f(
    target As UInteger,   ' DWORD
    u1 As Single,   ' FLOAT
    u2 As Single,   ' FLOAT
    stride As Integer,   ' INT
    order As Integer,   ' INT
    ByRef points As Single   ' FLOAT*
)
End Sub
' target : DWORD
' u1 : FLOAT
' u2 : FLOAT
' stride : INT
' order : INT
' points : FLOAT*
Declare PtrSafe Sub glMap1f Lib "opengl32" ( _
    ByVal target As Long, _
    ByVal u1 As Single, _
    ByVal u2 As Single, _
    ByVal stride As Long, _
    ByVal order As Long, _
    ByRef points As Single)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

glMap1f = ctypes.windll.opengl32.glMap1f
glMap1f.restype = None
glMap1f.argtypes = [
    wintypes.DWORD,  # target : DWORD
    ctypes.c_float,  # u1 : FLOAT
    ctypes.c_float,  # u2 : FLOAT
    ctypes.c_int,  # stride : INT
    ctypes.c_int,  # order : INT
    ctypes.POINTER(ctypes.c_float),  # points : FLOAT*
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('OPENGL32.dll')
glMap1f = Fiddle::Function.new(
  lib['glMap1f'],
  [
    -Fiddle::TYPE_INT,  # target : DWORD
    Fiddle::TYPE_FLOAT,  # u1 : FLOAT
    Fiddle::TYPE_FLOAT,  # u2 : FLOAT
    Fiddle::TYPE_INT,  # stride : INT
    Fiddle::TYPE_INT,  # order : INT
    Fiddle::TYPE_VOIDP,  # points : FLOAT*
  ],
  Fiddle::TYPE_VOID)
#[link(name = "opengl32")]
extern "system" {
    fn glMap1f(
        target: u32,  // DWORD
        u1: f32,  // FLOAT
        u2: f32,  // FLOAT
        stride: i32,  // INT
        order: i32,  // INT
        points: *const f32  // FLOAT*
    );
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("OPENGL32.dll")]
public static extern void glMap1f(uint target, float u1, float u2, int stride, int order, ref float points);
"@
$api = Add-Type -MemberDefinition $sig -Name 'OPENGL32_glMap1f' -Namespace Win32 -PassThru
# $api::glMap1f(target, u1, u2, stride, order, points)
#uselib "OPENGL32.dll"
#func global glMap1f "glMap1f" sptr, float, float, sptr, sptr, sptr
; glMap1f target, u1, u2, stride, order, varptr(points)
; target : DWORD -> "sptr"
; u1 : FLOAT -> "float"
; u2 : FLOAT -> "float"
; stride : INT -> "sptr"
; order : INT -> "sptr"
; points : FLOAT* -> "sptr"
出力引数:
#uselib "OPENGL32.dll"
#func global glMap1f "glMap1f" int, float, float, int, int, var
; glMap1f target, u1, u2, stride, order, points
; target : DWORD -> "int"
; u1 : FLOAT -> "float"
; u2 : FLOAT -> "float"
; stride : INT -> "int"
; order : INT -> "int"
; points : FLOAT* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; void glMap1f(DWORD target, FLOAT u1, FLOAT u2, INT stride, INT order, FLOAT* points)
#uselib "OPENGL32.dll"
#func global glMap1f "glMap1f" int, float, float, int, int, var
; glMap1f target, u1, u2, stride, order, points
; target : DWORD -> "int"
; u1 : FLOAT -> "float"
; u2 : FLOAT -> "float"
; stride : INT -> "int"
; order : INT -> "int"
; points : FLOAT* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"math"
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	opengl32 = windows.NewLazySystemDLL("OPENGL32.dll")
	procglMap1f = opengl32.NewProc("glMap1f")
)

// target (DWORD), u1 (FLOAT), u2 (FLOAT), stride (INT), order (INT), points (FLOAT*)
r1, _, err := procglMap1f.Call(
	uintptr(target),
	uintptr(math.Float32bits(u1)),
	uintptr(math.Float32bits(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 glMap1f(
  target: DWORD;   // DWORD
  u1: Single;   // FLOAT
  u2: Single;   // FLOAT
  stride: Integer;   // INT
  order: Integer;   // INT
  points: Pointer   // FLOAT*
); stdcall;
  external 'OPENGL32.dll' name 'glMap1f';
result := DllCall("OPENGL32\glMap1f"
    , "UInt", target   ; DWORD
    , "Float", u1   ; FLOAT
    , "Float", u2   ; FLOAT
    , "Int", stride   ; INT
    , "Int", order   ; INT
    , "Ptr", points   ; FLOAT*
    , "Int")   ; return: void
●glMap1f(target, u1, u2, stride, order, points) = DLL("OPENGL32.dll", "int glMap1f(dword, float, float, int, int, void*)")
# 呼び出し: glMap1f(target, u1, u2, stride, order, points)
# target : DWORD -> "dword"
# u1 : FLOAT -> "float"
# u2 : FLOAT -> "float"
# stride : INT -> "int"
# order : INT -> "int"
# points : FLOAT* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "opengl32" fn glMap1f(
    target: u32, // DWORD
    u1: f32, // FLOAT
    u2: f32, // FLOAT
    stride: i32, // INT
    order: i32, // INT
    points: [*c]f32 // FLOAT*
) callconv(std.os.windows.WINAPI) void;
proc glMap1f(
    target: uint32,  # DWORD
    u1: float32,  # FLOAT
    u2: float32,  # FLOAT
    stride: int32,  # INT
    order: int32,  # INT
    points: ptr float32  # FLOAT*
) {.importc: "glMap1f", stdcall, dynlib: "OPENGL32.dll".}
pragma(lib, "opengl32");
extern(Windows)
void glMap1f(
    uint target,   // DWORD
    float u1,   // FLOAT
    float u2,   // FLOAT
    int stride,   // INT
    int order,   // INT
    float* points   // FLOAT*
);
ccall((:glMap1f, "OPENGL32.dll"), stdcall, Cvoid,
      (UInt32, Float32, Float32, Int32, Int32, Ptr{Float32}),
      target, u1, u2, stride, order, points)
# target : DWORD -> UInt32
# u1 : FLOAT -> Float32
# u2 : FLOAT -> Float32
# stride : INT -> Int32
# order : INT -> Int32
# points : FLOAT* -> Ptr{Float32}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
void glMap1f(
    uint32_t target,
    float u1,
    float u2,
    int32_t stride,
    int32_t order,
    float* points);
]]
local opengl32 = ffi.load("opengl32")
-- opengl32.glMap1f(target, u1, u2, stride, order, points)
-- target : DWORD
-- u1 : FLOAT
-- u2 : FLOAT
-- stride : INT
-- order : INT
-- points : FLOAT*
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('OPENGL32.dll');
const glMap1f = lib.func('__stdcall', 'glMap1f', 'void', ['uint32_t', 'float', 'float', 'int32_t', 'int32_t', 'float *']);
// glMap1f(target, u1, u2, stride, order, points)
// target : DWORD -> 'uint32_t'
// u1 : FLOAT -> 'float'
// u2 : FLOAT -> 'float'
// stride : INT -> 'int32_t'
// order : INT -> 'int32_t'
// points : FLOAT* -> 'float *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("OPENGL32.dll", {
  glMap1f: { parameters: ["u32", "f32", "f32", "i32", "i32", "pointer"], result: "void" },
});
// lib.symbols.glMap1f(target, u1, u2, stride, order, points)
// target : DWORD -> "u32"
// u1 : FLOAT -> "f32"
// u2 : FLOAT -> "f32"
// stride : INT -> "i32"
// order : INT -> "i32"
// points : FLOAT* -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
void glMap1f(
    uint32_t target,
    float u1,
    float u2,
    int32_t stride,
    int32_t order,
    float* points);
C, "OPENGL32.dll");
// $ffi->glMap1f(target, u1, u2, stride, order, points);
// target : DWORD
// u1 : FLOAT
// u2 : FLOAT
// stride : INT
// order : INT
// points : FLOAT*
// 構造体/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 glMap1f(
        int target,   // DWORD
        float u1,   // FLOAT
        float u2,   // FLOAT
        int stride,   // INT
        int order,   // INT
        FloatByReference points   // FLOAT*
    );
}
@[Link("opengl32")]
lib LibOPENGL32
  fun glMap1f = glMap1f(
    target : UInt32,   # DWORD
    u1 : Float32,   # FLOAT
    u2 : Float32,   # FLOAT
    stride : Int32,   # INT
    order : Int32,   # INT
    points : Float32*   # FLOAT*
  ) : Void
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef glMap1fNative = Void Function(Uint32, Float, Float, Int32, Int32, Pointer<Float>);
typedef glMap1fDart = void Function(int, double, double, int, int, Pointer<Float>);
final glMap1f = DynamicLibrary.open('OPENGL32.dll')
    .lookupFunction<glMap1fNative, glMap1fDart>('glMap1f');
// target : DWORD -> Uint32
// u1 : FLOAT -> Float
// u2 : FLOAT -> Float
// stride : INT -> Int32
// order : INT -> Int32
// points : FLOAT* -> Pointer<Float>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
procedure glMap1f(
  target: DWORD;   // DWORD
  u1: Single;   // FLOAT
  u2: Single;   // FLOAT
  stride: Integer;   // INT
  order: Integer;   // INT
  points: Pointer   // FLOAT*
); stdcall;
  external 'OPENGL32.dll' name 'glMap1f';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "glMap1f"
  c_glMap1f :: Word32 -> CFloat -> CFloat -> Int32 -> Int32 -> Ptr CFloat -> IO ()
-- target : DWORD -> Word32
-- u1 : FLOAT -> CFloat
-- u2 : FLOAT -> CFloat
-- stride : INT -> Int32
-- order : INT -> Int32
-- points : FLOAT* -> Ptr CFloat
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let glmap1f =
  foreign "glMap1f"
    (uint32_t @-> float @-> float @-> int32_t @-> int32_t @-> (ptr float) @-> returning void)
(* target : DWORD -> uint32_t *)
(* u1 : FLOAT -> float *)
(* u2 : FLOAT -> float *)
(* stride : INT -> int32_t *)
(* order : INT -> int32_t *)
(* points : FLOAT* -> (ptr float) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library opengl32 (t "OPENGL32.dll"))
(cffi:use-foreign-library opengl32)

(cffi:defcfun ("glMap1f" gl-map1f :convention :stdcall) :void
  (target :uint32)   ; DWORD
  (u1 :float)   ; FLOAT
  (u2 :float)   ; FLOAT
  (stride :int32)   ; INT
  (order :int32)   ; INT
  (points :pointer))   ; FLOAT*
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $glMap1f = Win32::API::More->new('OPENGL32',
    'void glMap1f(DWORD target, float u1, float u2, int stride, int order, LPVOID points)');
# my $ret = $glMap1f->Call($target, $u1, $u2, $stride, $order, $points);
# target : DWORD -> DWORD
# u1 : FLOAT -> float
# u2 : FLOAT -> float
# stride : INT -> int
# order : INT -> int
# points : FLOAT* -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。