ホーム › Graphics.OpenGL › wglMakeCurrent
wglMakeCurrent
関数指定したOpenGLレンダリングコンテキストを現在のものにする。
シグネチャ
// OPENGL32.dll
#include <windows.h>
BOOL wglMakeCurrent(
HDC param0,
HGLRC param1
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| param0 | HDC | in |
| param1 | HGLRC | in |
戻り値の型: BOOL
各言語での呼び出し定義
// OPENGL32.dll
#include <windows.h>
BOOL wglMakeCurrent(
HDC param0,
HGLRC param1
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("OPENGL32.dll", SetLastError = true, ExactSpelling = true)]
static extern bool wglMakeCurrent(
IntPtr param0, // HDC
IntPtr param1 // HGLRC
);<DllImport("OPENGL32.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function wglMakeCurrent(
param0 As IntPtr, ' HDC
param1 As IntPtr ' HGLRC
) As Boolean
End Function' param0 : HDC
' param1 : HGLRC
Declare PtrSafe Function wglMakeCurrent Lib "opengl32" ( _
ByVal param0 As LongPtr, _
ByVal param1 As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
wglMakeCurrent = ctypes.windll.opengl32.wglMakeCurrent
wglMakeCurrent.restype = wintypes.BOOL
wglMakeCurrent.argtypes = [
wintypes.HANDLE, # param0 : HDC
wintypes.HANDLE, # param1 : HGLRC
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('OPENGL32.dll')
wglMakeCurrent = Fiddle::Function.new(
lib['wglMakeCurrent'],
[
Fiddle::TYPE_VOIDP, # param0 : HDC
Fiddle::TYPE_VOIDP, # param1 : HGLRC
],
Fiddle::TYPE_INT)#[link(name = "opengl32")]
extern "system" {
fn wglMakeCurrent(
param0: *mut core::ffi::c_void, // HDC
param1: *mut core::ffi::c_void // HGLRC
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("OPENGL32.dll", SetLastError = true)]
public static extern bool wglMakeCurrent(IntPtr param0, IntPtr param1);
"@
$api = Add-Type -MemberDefinition $sig -Name 'OPENGL32_wglMakeCurrent' -Namespace Win32 -PassThru
# $api::wglMakeCurrent(param0, param1)#uselib "OPENGL32.dll"
#func global wglMakeCurrent "wglMakeCurrent" sptr, sptr
; wglMakeCurrent param0, param1 ; 戻り値は stat
; param0 : HDC -> "sptr"
; param1 : HGLRC -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "OPENGL32.dll"
#cfunc global wglMakeCurrent "wglMakeCurrent" sptr, sptr
; res = wglMakeCurrent(param0, param1)
; param0 : HDC -> "sptr"
; param1 : HGLRC -> "sptr"; BOOL wglMakeCurrent(HDC param0, HGLRC param1)
#uselib "OPENGL32.dll"
#cfunc global wglMakeCurrent "wglMakeCurrent" intptr, intptr
; res = wglMakeCurrent(param0, param1)
; param0 : HDC -> "intptr"
; param1 : HGLRC -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
opengl32 = windows.NewLazySystemDLL("OPENGL32.dll")
procwglMakeCurrent = opengl32.NewProc("wglMakeCurrent")
)
// param0 (HDC), param1 (HGLRC)
r1, _, err := procwglMakeCurrent.Call(
uintptr(param0),
uintptr(param1),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction wglMakeCurrent(
param0: THandle; // HDC
param1: THandle // HGLRC
): BOOL; stdcall;
external 'OPENGL32.dll' name 'wglMakeCurrent';result := DllCall("OPENGL32\wglMakeCurrent"
, "Ptr", param0 ; HDC
, "Ptr", param1 ; HGLRC
, "Int") ; return: BOOL●wglMakeCurrent(param0, param1) = DLL("OPENGL32.dll", "bool wglMakeCurrent(void*, void*)")
# 呼び出し: wglMakeCurrent(param0, param1)
# param0 : HDC -> "void*"
# param1 : HGLRC -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。