ホーム › Graphics.OpenGL › glViewport
glViewport
関数レンダリング先のビューポート矩形の位置とサイズを設定する。
シグネチャ
// OPENGL32.dll
#include <windows.h>
void glViewport(
INT x,
INT y,
INT width,
INT height
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| x | INT | in |
| y | INT | in |
| width | INT | in |
| height | INT | in |
戻り値の型: void
各言語での呼び出し定義
// OPENGL32.dll
#include <windows.h>
void glViewport(
INT x,
INT y,
INT width,
INT height
);[DllImport("OPENGL32.dll", ExactSpelling = true)]
static extern void glViewport(
int x, // INT
int y, // INT
int width, // INT
int height // INT
);<DllImport("OPENGL32.dll", ExactSpelling:=True)>
Public Shared Sub glViewport(
x As Integer, ' INT
y As Integer, ' INT
width As Integer, ' INT
height As Integer ' INT
)
End Sub' x : INT
' y : INT
' width : INT
' height : INT
Declare PtrSafe Sub glViewport Lib "opengl32" ( _
ByVal x As Long, _
ByVal y As Long, _
ByVal width As Long, _
ByVal height As Long)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
glViewport = ctypes.windll.opengl32.glViewport
glViewport.restype = None
glViewport.argtypes = [
ctypes.c_int, # x : INT
ctypes.c_int, # y : INT
ctypes.c_int, # width : INT
ctypes.c_int, # height : INT
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('OPENGL32.dll')
glViewport = Fiddle::Function.new(
lib['glViewport'],
[
Fiddle::TYPE_INT, # x : INT
Fiddle::TYPE_INT, # y : INT
Fiddle::TYPE_INT, # width : INT
Fiddle::TYPE_INT, # height : INT
],
Fiddle::TYPE_VOID)#[link(name = "opengl32")]
extern "system" {
fn glViewport(
x: i32, // INT
y: i32, // INT
width: i32, // INT
height: i32 // INT
);
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("OPENGL32.dll")]
public static extern void glViewport(int x, int y, int width, int height);
"@
$api = Add-Type -MemberDefinition $sig -Name 'OPENGL32_glViewport' -Namespace Win32 -PassThru
# $api::glViewport(x, y, width, height)#uselib "OPENGL32.dll"
#func global glViewport "glViewport" sptr, sptr, sptr, sptr
; glViewport x, y, width, height
; x : INT -> "sptr"
; y : INT -> "sptr"
; width : INT -> "sptr"
; height : INT -> "sptr"#uselib "OPENGL32.dll"
#func global glViewport "glViewport" int, int, int, int
; glViewport x, y, width, height
; x : INT -> "int"
; y : INT -> "int"
; width : INT -> "int"
; height : INT -> "int"; void glViewport(INT x, INT y, INT width, INT height)
#uselib "OPENGL32.dll"
#func global glViewport "glViewport" int, int, int, int
; glViewport x, y, width, height
; x : INT -> "int"
; y : INT -> "int"
; width : INT -> "int"
; height : INT -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
opengl32 = windows.NewLazySystemDLL("OPENGL32.dll")
procglViewport = opengl32.NewProc("glViewport")
)
// x (INT), y (INT), width (INT), height (INT)
r1, _, err := procglViewport.Call(
uintptr(x),
uintptr(y),
uintptr(width),
uintptr(height),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // voidprocedure glViewport(
x: Integer; // INT
y: Integer; // INT
width: Integer; // INT
height: Integer // INT
); stdcall;
external 'OPENGL32.dll' name 'glViewport';result := DllCall("OPENGL32\glViewport"
, "Int", x ; INT
, "Int", y ; INT
, "Int", width ; INT
, "Int", height ; INT
, "Int") ; return: void●glViewport(x, y, width, height) = DLL("OPENGL32.dll", "int glViewport(int, int, int, int)")
# 呼び出し: glViewport(x, y, width, height)
# x : INT -> "int"
# y : INT -> "int"
# width : INT -> "int"
# height : INT -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。