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

glRectfv

関数
単精度座標配列で塗りつぶし矩形を描画する。
DLLOPENGL32.dll呼出規約winapi

シグネチャ

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

void glRectfv(
    const FLOAT* v1,
    const FLOAT* v2
);

パラメーター

名前方向説明
v1FLOAT*in矩形の一方の頂点のx,y座標を保持する単精度配列へのポインタ。
v2FLOAT*in対角の頂点のx,y座標を保持する単精度配列へのポインタ。

戻り値の型: void

各言語での呼び出し定義

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

void glRectfv(
    const FLOAT* v1,
    const FLOAT* v2
);
[DllImport("OPENGL32.dll", ExactSpelling = true)]
static extern void glRectfv(
    ref float v1,   // FLOAT*
    ref float v2   // FLOAT*
);
<DllImport("OPENGL32.dll", ExactSpelling:=True)>
Public Shared Sub glRectfv(
    ByRef v1 As Single,   ' FLOAT*
    ByRef v2 As Single   ' FLOAT*
)
End Sub
' v1 : FLOAT*
' v2 : FLOAT*
Declare PtrSafe Sub glRectfv Lib "opengl32" ( _
    ByRef v1 As Single, _
    ByRef v2 As Single)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

glRectfv = ctypes.windll.opengl32.glRectfv
glRectfv.restype = None
glRectfv.argtypes = [
    ctypes.POINTER(ctypes.c_float),  # v1 : FLOAT*
    ctypes.POINTER(ctypes.c_float),  # v2 : FLOAT*
]
require 'fiddle'
require 'fiddle/import'

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

var (
	opengl32 = windows.NewLazySystemDLL("OPENGL32.dll")
	procglRectfv = opengl32.NewProc("glRectfv")
)

// v1 (FLOAT*), v2 (FLOAT*)
r1, _, err := procglRectfv.Call(
	uintptr(v1),
	uintptr(v2),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // void
procedure glRectfv(
  v1: Pointer;   // FLOAT*
  v2: Pointer   // FLOAT*
); stdcall;
  external 'OPENGL32.dll' name 'glRectfv';
result := DllCall("OPENGL32\glRectfv"
    , "Ptr", v1   ; FLOAT*
    , "Ptr", v2   ; FLOAT*
    , "Int")   ; return: void
●glRectfv(v1, v2) = DLL("OPENGL32.dll", "int glRectfv(void*, void*)")
# 呼び出し: glRectfv(v1, v2)
# v1 : FLOAT* -> "void*"
# v2 : FLOAT* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "opengl32" fn glRectfv(
    v1: [*c]f32, // FLOAT*
    v2: [*c]f32 // FLOAT*
) callconv(std.os.windows.WINAPI) void;
proc glRectfv(
    v1: ptr float32,  # FLOAT*
    v2: ptr float32  # FLOAT*
) {.importc: "glRectfv", stdcall, dynlib: "OPENGL32.dll".}
pragma(lib, "opengl32");
extern(Windows)
void glRectfv(
    float* v1,   // FLOAT*
    float* v2   // FLOAT*
);
ccall((:glRectfv, "OPENGL32.dll"), stdcall, Cvoid,
      (Ptr{Float32}, Ptr{Float32}),
      v1, v2)
# v1 : FLOAT* -> Ptr{Float32}
# v2 : FLOAT* -> Ptr{Float32}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
void glRectfv(
    float* v1,
    float* v2);
]]
local opengl32 = ffi.load("opengl32")
-- opengl32.glRectfv(v1, v2)
-- v1 : FLOAT*
-- v2 : FLOAT*
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('OPENGL32.dll');
const glRectfv = lib.func('__stdcall', 'glRectfv', 'void', ['float *', 'float *']);
// glRectfv(v1, v2)
// v1 : FLOAT* -> 'float *'
// v2 : FLOAT* -> 'float *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("OPENGL32.dll", {
  glRectfv: { parameters: ["pointer", "pointer"], result: "void" },
});
// lib.symbols.glRectfv(v1, v2)
// v1 : FLOAT* -> "pointer"
// v2 : FLOAT* -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
void glRectfv(
    float* v1,
    float* v2);
C, "OPENGL32.dll");
// $ffi->glRectfv(v1, v2);
// v1 : FLOAT*
// v2 : 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 glRectfv(
        FloatByReference v1,   // FLOAT*
        FloatByReference v2   // FLOAT*
    );
}
@[Link("opengl32")]
lib LibOPENGL32
  fun glRectfv = glRectfv(
    v1 : Float32*,   # FLOAT*
    v2 : 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 glRectfvNative = Void Function(Pointer<Float>, Pointer<Float>);
typedef glRectfvDart = void Function(Pointer<Float>, Pointer<Float>);
final glRectfv = DynamicLibrary.open('OPENGL32.dll')
    .lookupFunction<glRectfvNative, glRectfvDart>('glRectfv');
// v1 : FLOAT* -> Pointer<Float>
// v2 : FLOAT* -> Pointer<Float>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
procedure glRectfv(
  v1: Pointer;   // FLOAT*
  v2: Pointer   // FLOAT*
); stdcall;
  external 'OPENGL32.dll' name 'glRectfv';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "glRectfv"
  c_glRectfv :: Ptr CFloat -> Ptr CFloat -> IO ()
-- v1 : FLOAT* -> Ptr CFloat
-- v2 : FLOAT* -> Ptr CFloat
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let glrectfv =
  foreign "glRectfv"
    ((ptr float) @-> (ptr float) @-> returning void)
(* v1 : FLOAT* -> (ptr float) *)
(* v2 : 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 ("glRectfv" gl-rectfv :convention :stdcall) :void
  (v1 :pointer)   ; FLOAT*
  (v2 :pointer))   ; FLOAT*
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $glRectfv = Win32::API::More->new('OPENGL32',
    'void glRectfv(LPVOID v1, LPVOID v2)');
# my $ret = $glRectfv->Call($v1, $v2);
# v1 : FLOAT* -> LPVOID
# v2 : FLOAT* -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。