ホーム › Graphics.OpenGL › gluCylinder
gluCylinder
関数クワドリックを用いて円柱や円錐を描画する。
シグネチャ
// GLU32.dll
#include <windows.h>
void gluCylinder(
GLUquadric* qobj,
DOUBLE baseRadius,
DOUBLE topRadius,
DOUBLE height,
INT slices,
INT stacks
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| qobj | GLUquadric* | inout |
| baseRadius | DOUBLE | in |
| topRadius | DOUBLE | in |
| height | DOUBLE | in |
| slices | INT | in |
| stacks | INT | in |
戻り値の型: void
各言語での呼び出し定義
// GLU32.dll
#include <windows.h>
void gluCylinder(
GLUquadric* qobj,
DOUBLE baseRadius,
DOUBLE topRadius,
DOUBLE height,
INT slices,
INT stacks
);[DllImport("GLU32.dll", ExactSpelling = true)]
static extern void gluCylinder(
ref IntPtr qobj, // GLUquadric* in/out
double baseRadius, // DOUBLE
double topRadius, // DOUBLE
double height, // DOUBLE
int slices, // INT
int stacks // INT
);<DllImport("GLU32.dll", ExactSpelling:=True)>
Public Shared Sub gluCylinder(
ByRef qobj As IntPtr, ' GLUquadric* in/out
baseRadius As Double, ' DOUBLE
topRadius As Double, ' DOUBLE
height As Double, ' DOUBLE
slices As Integer, ' INT
stacks As Integer ' INT
)
End Sub' qobj : GLUquadric* in/out
' baseRadius : DOUBLE
' topRadius : DOUBLE
' height : DOUBLE
' slices : INT
' stacks : INT
Declare PtrSafe Sub gluCylinder Lib "glu32" ( _
ByRef qobj As LongPtr, _
ByVal baseRadius As Double, _
ByVal topRadius As Double, _
ByVal height As Double, _
ByVal slices As Long, _
ByVal stacks As Long)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
gluCylinder = ctypes.windll.glu32.gluCylinder
gluCylinder.restype = None
gluCylinder.argtypes = [
ctypes.c_void_p, # qobj : GLUquadric* in/out
ctypes.c_double, # baseRadius : DOUBLE
ctypes.c_double, # topRadius : DOUBLE
ctypes.c_double, # height : DOUBLE
ctypes.c_int, # slices : INT
ctypes.c_int, # stacks : INT
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('GLU32.dll')
gluCylinder = Fiddle::Function.new(
lib['gluCylinder'],
[
Fiddle::TYPE_VOIDP, # qobj : GLUquadric* in/out
Fiddle::TYPE_DOUBLE, # baseRadius : DOUBLE
Fiddle::TYPE_DOUBLE, # topRadius : DOUBLE
Fiddle::TYPE_DOUBLE, # height : DOUBLE
Fiddle::TYPE_INT, # slices : INT
Fiddle::TYPE_INT, # stacks : INT
],
Fiddle::TYPE_VOID)#[link(name = "glu32")]
extern "system" {
fn gluCylinder(
qobj: *mut isize, // GLUquadric* in/out
baseRadius: f64, // DOUBLE
topRadius: f64, // DOUBLE
height: f64, // DOUBLE
slices: i32, // INT
stacks: i32 // INT
);
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("GLU32.dll")]
public static extern void gluCylinder(ref IntPtr qobj, double baseRadius, double topRadius, double height, int slices, int stacks);
"@
$api = Add-Type -MemberDefinition $sig -Name 'GLU32_gluCylinder' -Namespace Win32 -PassThru
# $api::gluCylinder(qobj, baseRadius, topRadius, height, slices, stacks)#uselib "GLU32.dll"
#func global gluCylinder "gluCylinder" sptr, double, double, double, sptr, sptr
; gluCylinder qobj, baseRadius, topRadius, height, slices, stacks
; qobj : GLUquadric* in/out -> "sptr"
; baseRadius : DOUBLE -> "double"
; topRadius : DOUBLE -> "double"
; height : DOUBLE -> "double"
; slices : INT -> "sptr"
; stacks : INT -> "sptr"#uselib "GLU32.dll"
#func global gluCylinder "gluCylinder" int, double, double, double, int, int
; gluCylinder qobj, baseRadius, topRadius, height, slices, stacks
; qobj : GLUquadric* in/out -> "int"
; baseRadius : DOUBLE -> "double"
; topRadius : DOUBLE -> "double"
; height : DOUBLE -> "double"
; slices : INT -> "int"
; stacks : INT -> "int"; void gluCylinder(GLUquadric* qobj, DOUBLE baseRadius, DOUBLE topRadius, DOUBLE height, INT slices, INT stacks)
#uselib "GLU32.dll"
#func global gluCylinder "gluCylinder" int, double, double, double, int, int
; gluCylinder qobj, baseRadius, topRadius, height, slices, stacks
; qobj : GLUquadric* in/out -> "int"
; baseRadius : DOUBLE -> "double"
; topRadius : DOUBLE -> "double"
; height : DOUBLE -> "double"
; slices : INT -> "int"
; stacks : INT -> "int"import (
"math"
"golang.org/x/sys/windows"
"unsafe"
)
var (
glu32 = windows.NewLazySystemDLL("GLU32.dll")
procgluCylinder = glu32.NewProc("gluCylinder")
)
// qobj (GLUquadric* in/out), baseRadius (DOUBLE), topRadius (DOUBLE), height (DOUBLE), slices (INT), stacks (INT)
r1, _, err := procgluCylinder.Call(
uintptr(qobj),
uintptr(math.Float64bits(baseRadius)),
uintptr(math.Float64bits(topRadius)),
uintptr(math.Float64bits(height)),
uintptr(slices),
uintptr(stacks),
)
_ = 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 gluCylinder(
qobj: Pointer; // GLUquadric* in/out
baseRadius: Double; // DOUBLE
topRadius: Double; // DOUBLE
height: Double; // DOUBLE
slices: Integer; // INT
stacks: Integer // INT
); stdcall;
external 'GLU32.dll' name 'gluCylinder';result := DllCall("GLU32\gluCylinder"
, "Ptr", qobj ; GLUquadric* in/out
, "Double", baseRadius ; DOUBLE
, "Double", topRadius ; DOUBLE
, "Double", height ; DOUBLE
, "Int", slices ; INT
, "Int", stacks ; INT
, "Int") ; return: void●gluCylinder(qobj, baseRadius, topRadius, height, slices, stacks) = DLL("GLU32.dll", "int gluCylinder(void*, double, double, double, int, int)")
# 呼び出し: gluCylinder(qobj, baseRadius, topRadius, height, slices, stacks)
# qobj : GLUquadric* in/out -> "void*"
# baseRadius : DOUBLE -> "double"
# topRadius : DOUBLE -> "double"
# height : DOUBLE -> "double"
# slices : INT -> "int"
# stacks : INT -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。