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

gluPwlCurve

関数
トリミング用の折れ線(区分線形)曲線を定義する。
DLLGLU32.dll呼出規約winapi

シグネチャ

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

void gluPwlCurve(
    GLUnurbs* nobj,
    INT count,
    FLOAT* array,
    INT stride,
    DWORD type
);

パラメーター

名前方向説明
nobjGLUnurbs*inout対象のNURBSレンダラオブジェクトへのポインタ。
countINTin折れ線曲線を構成する点の数。
arrayFLOAT*inout点座標の並びを格納したFLOAT配列へのポインタ。
strideINTin連続する点間のFLOAT要素数(オフセット)。
typeDWORDin曲線の種類。GLU_MAP1_TRIM_2またはGLU_MAP1_TRIM_3。

戻り値の型: void

各言語での呼び出し定義

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

void gluPwlCurve(
    GLUnurbs* nobj,
    INT count,
    FLOAT* array,
    INT stride,
    DWORD type
);
[DllImport("GLU32.dll", ExactSpelling = true)]
static extern void gluPwlCurve(
    ref IntPtr nobj,   // GLUnurbs* in/out
    int count,   // INT
    ref float array,   // FLOAT* in/out
    int stride,   // INT
    uint type   // DWORD
);
<DllImport("GLU32.dll", ExactSpelling:=True)>
Public Shared Sub gluPwlCurve(
    ByRef nobj As IntPtr,   ' GLUnurbs* in/out
    count As Integer,   ' INT
    ByRef array As Single,   ' FLOAT* in/out
    stride As Integer,   ' INT
    type As UInteger   ' DWORD
)
End Sub
' nobj : GLUnurbs* in/out
' count : INT
' array : FLOAT* in/out
' stride : INT
' type : DWORD
Declare PtrSafe Sub gluPwlCurve Lib "glu32" ( _
    ByRef nobj As LongPtr, _
    ByVal count As Long, _
    ByRef array As Single, _
    ByVal stride As Long, _
    ByVal type As Long)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

gluPwlCurve = ctypes.windll.glu32.gluPwlCurve
gluPwlCurve.restype = None
gluPwlCurve.argtypes = [
    ctypes.c_void_p,  # nobj : GLUnurbs* in/out
    ctypes.c_int,  # count : INT
    ctypes.POINTER(ctypes.c_float),  # array : FLOAT* in/out
    ctypes.c_int,  # stride : INT
    wintypes.DWORD,  # type : DWORD
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('GLU32.dll')
gluPwlCurve = Fiddle::Function.new(
  lib['gluPwlCurve'],
  [
    Fiddle::TYPE_VOIDP,  # nobj : GLUnurbs* in/out
    Fiddle::TYPE_INT,  # count : INT
    Fiddle::TYPE_VOIDP,  # array : FLOAT* in/out
    Fiddle::TYPE_INT,  # stride : INT
    -Fiddle::TYPE_INT,  # type : DWORD
  ],
  Fiddle::TYPE_VOID)
#[link(name = "glu32")]
extern "system" {
    fn gluPwlCurve(
        nobj: *mut isize,  // GLUnurbs* in/out
        count: i32,  // INT
        array: *mut f32,  // FLOAT* in/out
        stride: i32,  // INT
        type: u32  // DWORD
    );
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("GLU32.dll")]
public static extern void gluPwlCurve(ref IntPtr nobj, int count, ref float array, int stride, uint type);
"@
$api = Add-Type -MemberDefinition $sig -Name 'GLU32_gluPwlCurve' -Namespace Win32 -PassThru
# $api::gluPwlCurve(nobj, count, array, stride, type)
#uselib "GLU32.dll"
#func global gluPwlCurve "gluPwlCurve" sptr, sptr, sptr, sptr, sptr
; gluPwlCurve varptr(nobj), count, varptr(array), stride, type
; nobj : GLUnurbs* in/out -> "sptr"
; count : INT -> "sptr"
; array : FLOAT* in/out -> "sptr"
; stride : INT -> "sptr"
; type : DWORD -> "sptr"
出力引数:
#uselib "GLU32.dll"
#func global gluPwlCurve "gluPwlCurve" var, int, var, int, int
; gluPwlCurve nobj, count, array, stride, type
; nobj : GLUnurbs* in/out -> "var"
; count : INT -> "int"
; array : FLOAT* in/out -> "var"
; stride : INT -> "int"
; type : DWORD -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; void gluPwlCurve(GLUnurbs* nobj, INT count, FLOAT* array, INT stride, DWORD type)
#uselib "GLU32.dll"
#func global gluPwlCurve "gluPwlCurve" var, int, var, int, int
; gluPwlCurve nobj, count, array, stride, type
; nobj : GLUnurbs* in/out -> "var"
; count : INT -> "int"
; array : FLOAT* in/out -> "var"
; stride : INT -> "int"
; type : DWORD -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	glu32 = windows.NewLazySystemDLL("GLU32.dll")
	procgluPwlCurve = glu32.NewProc("gluPwlCurve")
)

// nobj (GLUnurbs* in/out), count (INT), array (FLOAT* in/out), stride (INT), type (DWORD)
r1, _, err := procgluPwlCurve.Call(
	uintptr(nobj),
	uintptr(count),
	uintptr(array),
	uintptr(stride),
	uintptr(type),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // void
procedure gluPwlCurve(
  nobj: Pointer;   // GLUnurbs* in/out
  count: Integer;   // INT
  array: Pointer;   // FLOAT* in/out
  stride: Integer;   // INT
  type: DWORD   // DWORD
); stdcall;
  external 'GLU32.dll' name 'gluPwlCurve';
result := DllCall("GLU32\gluPwlCurve"
    , "Ptr", nobj   ; GLUnurbs* in/out
    , "Int", count   ; INT
    , "Ptr", array   ; FLOAT* in/out
    , "Int", stride   ; INT
    , "UInt", type   ; DWORD
    , "Int")   ; return: void
●gluPwlCurve(nobj, count, array, stride, type) = DLL("GLU32.dll", "int gluPwlCurve(void*, int, void*, int, dword)")
# 呼び出し: gluPwlCurve(nobj, count, array, stride, type)
# nobj : GLUnurbs* in/out -> "void*"
# count : INT -> "int"
# array : FLOAT* in/out -> "void*"
# stride : INT -> "int"
# type : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

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

typedef gluPwlCurveNative = Void Function(Pointer<IntPtr>, Int32, Pointer<Float>, Int32, Uint32);
typedef gluPwlCurveDart = void Function(Pointer<IntPtr>, int, Pointer<Float>, int, int);
final gluPwlCurve = DynamicLibrary.open('GLU32.dll')
    .lookupFunction<gluPwlCurveNative, gluPwlCurveDart>('gluPwlCurve');
// nobj : GLUnurbs* in/out -> Pointer<IntPtr>
// count : INT -> Int32
// array : FLOAT* in/out -> Pointer<Float>
// stride : INT -> Int32
// type : DWORD -> Uint32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
procedure gluPwlCurve(
  nobj: Pointer;   // GLUnurbs* in/out
  count: Integer;   // INT
  array: Pointer;   // FLOAT* in/out
  stride: Integer;   // INT
  type: DWORD   // DWORD
); stdcall;
  external 'GLU32.dll' name 'gluPwlCurve';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "gluPwlCurve"
  c_gluPwlCurve :: Ptr CIntPtr -> Int32 -> Ptr CFloat -> Int32 -> Word32 -> IO ()
-- nobj : GLUnurbs* in/out -> Ptr CIntPtr
-- count : INT -> Int32
-- array : FLOAT* in/out -> Ptr CFloat
-- stride : INT -> Int32
-- type : DWORD -> Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let glupwlcurve =
  foreign "gluPwlCurve"
    ((ptr intptr_t) @-> int32_t @-> (ptr float) @-> int32_t @-> uint32_t @-> returning void)
(* nobj : GLUnurbs* in/out -> (ptr intptr_t) *)
(* count : INT -> int32_t *)
(* array : FLOAT* in/out -> (ptr float) *)
(* stride : INT -> int32_t *)
(* type : DWORD -> uint32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library glu32 (t "GLU32.dll"))
(cffi:use-foreign-library glu32)

(cffi:defcfun ("gluPwlCurve" glu-pwl-curve :convention :stdcall) :void
  (nobj :pointer)   ; GLUnurbs* in/out
  (count :int32)   ; INT
  (array :pointer)   ; FLOAT* in/out
  (stride :int32)   ; INT
  (type :uint32))   ; DWORD
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $gluPwlCurve = Win32::API::More->new('GLU32',
    'void gluPwlCurve(LPVOID nobj, int count, LPVOID array, int stride, DWORD type)');
# my $ret = $gluPwlCurve->Call($nobj, $count, $array, $stride, $type);
# nobj : GLUnurbs* in/out -> LPVOID
# count : INT -> int
# array : FLOAT* in/out -> LPVOID
# stride : INT -> int
# type : DWORD -> DWORD
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。