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

gluSphere

関数
クワドリックを用いて球を描画する。
DLLGLU32.dll呼出規約winapi

シグネチャ

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

void gluSphere(
    GLUquadric* qobj,
    DOUBLE radius,
    INT slices,
    INT stacks
);

パラメーター

名前方向
qobjGLUquadric*inout
radiusDOUBLEin
slicesINTin
stacksINTin

戻り値の型: void

各言語での呼び出し定義

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

void gluSphere(
    GLUquadric* qobj,
    DOUBLE radius,
    INT slices,
    INT stacks
);
[DllImport("GLU32.dll", ExactSpelling = true)]
static extern void gluSphere(
    ref IntPtr qobj,   // GLUquadric* in/out
    double radius,   // DOUBLE
    int slices,   // INT
    int stacks   // INT
);
<DllImport("GLU32.dll", ExactSpelling:=True)>
Public Shared Sub gluSphere(
    ByRef qobj As IntPtr,   ' GLUquadric* in/out
    radius As Double,   ' DOUBLE
    slices As Integer,   ' INT
    stacks As Integer   ' INT
)
End Sub
' qobj : GLUquadric* in/out
' radius : DOUBLE
' slices : INT
' stacks : INT
Declare PtrSafe Sub gluSphere Lib "glu32" ( _
    ByRef qobj As LongPtr, _
    ByVal radius 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

gluSphere = ctypes.windll.glu32.gluSphere
gluSphere.restype = None
gluSphere.argtypes = [
    ctypes.c_void_p,  # qobj : GLUquadric* in/out
    ctypes.c_double,  # radius : DOUBLE
    ctypes.c_int,  # slices : INT
    ctypes.c_int,  # stacks : INT
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('GLU32.dll')
gluSphere = Fiddle::Function.new(
  lib['gluSphere'],
  [
    Fiddle::TYPE_VOIDP,  # qobj : GLUquadric* in/out
    Fiddle::TYPE_DOUBLE,  # radius : DOUBLE
    Fiddle::TYPE_INT,  # slices : INT
    Fiddle::TYPE_INT,  # stacks : INT
  ],
  Fiddle::TYPE_VOID)
#[link(name = "glu32")]
extern "system" {
    fn gluSphere(
        qobj: *mut isize,  // GLUquadric* in/out
        radius: 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 gluSphere(ref IntPtr qobj, double radius, int slices, int stacks);
"@
$api = Add-Type -MemberDefinition $sig -Name 'GLU32_gluSphere' -Namespace Win32 -PassThru
# $api::gluSphere(qobj, radius, slices, stacks)
#uselib "GLU32.dll"
#func global gluSphere "gluSphere" sptr, double, sptr, sptr
; gluSphere qobj, radius, slices, stacks
; qobj : GLUquadric* in/out -> "sptr"
; radius : DOUBLE -> "double"
; slices : INT -> "sptr"
; stacks : INT -> "sptr"
#uselib "GLU32.dll"
#func global gluSphere "gluSphere" int, double, int, int
; gluSphere qobj, radius, slices, stacks
; qobj : GLUquadric* in/out -> "int"
; radius : DOUBLE -> "double"
; slices : INT -> "int"
; stacks : INT -> "int"
; void gluSphere(GLUquadric* qobj, DOUBLE radius, INT slices, INT stacks)
#uselib "GLU32.dll"
#func global gluSphere "gluSphere" int, double, int, int
; gluSphere qobj, radius, slices, stacks
; qobj : GLUquadric* in/out -> "int"
; radius : DOUBLE -> "double"
; slices : INT -> "int"
; stacks : INT -> "int"
import (
	"math"
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	glu32 = windows.NewLazySystemDLL("GLU32.dll")
	procgluSphere = glu32.NewProc("gluSphere")
)

// qobj (GLUquadric* in/out), radius (DOUBLE), slices (INT), stacks (INT)
r1, _, err := procgluSphere.Call(
	uintptr(qobj),
	uintptr(math.Float64bits(radius)),
	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 gluSphere(
  qobj: Pointer;   // GLUquadric* in/out
  radius: Double;   // DOUBLE
  slices: Integer;   // INT
  stacks: Integer   // INT
); stdcall;
  external 'GLU32.dll' name 'gluSphere';
result := DllCall("GLU32\gluSphere"
    , "Ptr", qobj   ; GLUquadric* in/out
    , "Double", radius   ; DOUBLE
    , "Int", slices   ; INT
    , "Int", stacks   ; INT
    , "Int")   ; return: void
●gluSphere(qobj, radius, slices, stacks) = DLL("GLU32.dll", "int gluSphere(void*, double, int, int)")
# 呼び出し: gluSphere(qobj, radius, slices, stacks)
# qobj : GLUquadric* in/out -> "void*"
# radius : DOUBLE -> "double"
# slices : INT -> "int"
# stacks : INT -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。