objc2_app_kit/generated/
NSOpenGL.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7#[cfg(feature = "objc2-open-gl")]
8#[cfg(target_vendor = "apple")]
9use objc2_open_gl::*;
10
11use crate::*;
12
13/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglglobaloption?language=objc)
14#[deprecated = "OpenGL API deprecated; please use Metal and MetalKit.  (Define GL_SILENCE_DEPRECATION to silence these warnings.)"]
15#[repr(transparent)]
16#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
17pub struct NSOpenGLGlobalOption(pub u32);
18impl NSOpenGLGlobalOption {
19    #[doc(alias = "NSOpenGLGOFormatCacheSize")]
20    #[deprecated = "OpenGL API deprecated; please use Metal and MetalKit.  (Define GL_SILENCE_DEPRECATION to silence these warnings.)"]
21    pub const GLGOFormatCacheSize: Self = Self(501);
22    #[doc(alias = "NSOpenGLGOClearFormatCache")]
23    #[deprecated = "OpenGL API deprecated; please use Metal and MetalKit.  (Define GL_SILENCE_DEPRECATION to silence these warnings.)"]
24    pub const GLGOClearFormatCache: Self = Self(502);
25    #[doc(alias = "NSOpenGLGORetainRenderers")]
26    #[deprecated = "OpenGL API deprecated; please use Metal and MetalKit.  (Define GL_SILENCE_DEPRECATION to silence these warnings.)"]
27    pub const GLGORetainRenderers: Self = Self(503);
28    #[doc(alias = "NSOpenGLGOUseBuildCache")]
29    #[deprecated = "OpenGL API deprecated; please use Metal and MetalKit.  (Define GL_SILENCE_DEPRECATION to silence these warnings.)"]
30    pub const GLGOUseBuildCache: Self = Self(506);
31    #[doc(alias = "NSOpenGLGOResetLibrary")]
32    #[deprecated]
33    pub const GLGOResetLibrary: Self = Self(504);
34}
35
36unsafe impl Encode for NSOpenGLGlobalOption {
37    const ENCODING: Encoding = u32::ENCODING;
38}
39
40unsafe impl RefEncode for NSOpenGLGlobalOption {
41    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
42}
43
44#[cfg(feature = "objc2-open-gl")]
45#[cfg(target_vendor = "apple")]
46#[deprecated = "OpenGL API deprecated; please use Metal and MetalKit.  (Define GL_SILENCE_DEPRECATION to silence these warnings.)"]
47#[inline]
48pub extern "C-unwind" fn NSOpenGLSetOption(pname: NSOpenGLGlobalOption, param: GLint) {
49    extern "C-unwind" {
50        fn NSOpenGLSetOption(pname: NSOpenGLGlobalOption, param: GLint);
51    }
52    unsafe { NSOpenGLSetOption(pname, param) }
53}
54
55extern "C-unwind" {
56    /// # Safety
57    ///
58    /// `param` must be a valid pointer.
59    #[cfg(feature = "objc2-open-gl")]
60    #[cfg(target_vendor = "apple")]
61    #[deprecated = "OpenGL API deprecated; please use Metal and MetalKit.  (Define GL_SILENCE_DEPRECATION to silence these warnings.)"]
62    pub fn NSOpenGLGetOption(pname: NSOpenGLGlobalOption, param: NonNull<GLint>);
63}
64
65extern "C-unwind" {
66    /// # Safety
67    ///
68    /// - `major` must be a valid pointer or null.
69    /// - `minor` must be a valid pointer or null.
70    #[cfg(feature = "objc2-open-gl")]
71    #[cfg(target_vendor = "apple")]
72    #[deprecated = "OpenGL API deprecated; please use Metal and MetalKit.  (Define GL_SILENCE_DEPRECATION to silence these warnings.)"]
73    pub fn NSOpenGLGetVersion(major: *mut GLint, minor: *mut GLint);
74}
75
76/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglpfaallrenderers?language=objc)
77#[deprecated = "OpenGL API deprecated; please use Metal and MetalKit.  (Define GL_SILENCE_DEPRECATION to silence these warnings.)"]
78pub const NSOpenGLPFAAllRenderers: c_uint = 1;
79/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglpfatriplebuffer?language=objc)
80#[deprecated = "OpenGL API deprecated; please use Metal and MetalKit.  (Define GL_SILENCE_DEPRECATION to silence these warnings.)"]
81pub const NSOpenGLPFATripleBuffer: c_uint = 3;
82/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglpfadoublebuffer?language=objc)
83#[deprecated = "OpenGL API deprecated; please use Metal and MetalKit.  (Define GL_SILENCE_DEPRECATION to silence these warnings.)"]
84pub const NSOpenGLPFADoubleBuffer: c_uint = 5;
85/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglpfaauxbuffers?language=objc)
86#[deprecated = "OpenGL API deprecated; please use Metal and MetalKit.  (Define GL_SILENCE_DEPRECATION to silence these warnings.)"]
87pub const NSOpenGLPFAAuxBuffers: c_uint = 7;
88/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglpfacolorsize?language=objc)
89#[deprecated = "OpenGL API deprecated; please use Metal and MetalKit.  (Define GL_SILENCE_DEPRECATION to silence these warnings.)"]
90pub const NSOpenGLPFAColorSize: c_uint = 8;
91/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglpfaalphasize?language=objc)
92#[deprecated = "OpenGL API deprecated; please use Metal and MetalKit.  (Define GL_SILENCE_DEPRECATION to silence these warnings.)"]
93pub const NSOpenGLPFAAlphaSize: c_uint = 11;
94/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglpfadepthsize?language=objc)
95#[deprecated = "OpenGL API deprecated; please use Metal and MetalKit.  (Define GL_SILENCE_DEPRECATION to silence these warnings.)"]
96pub const NSOpenGLPFADepthSize: c_uint = 12;
97/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglpfastencilsize?language=objc)
98#[deprecated = "OpenGL API deprecated; please use Metal and MetalKit.  (Define GL_SILENCE_DEPRECATION to silence these warnings.)"]
99pub const NSOpenGLPFAStencilSize: c_uint = 13;
100/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglpfaaccumsize?language=objc)
101#[deprecated = "OpenGL API deprecated; please use Metal and MetalKit.  (Define GL_SILENCE_DEPRECATION to silence these warnings.)"]
102pub const NSOpenGLPFAAccumSize: c_uint = 14;
103/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglpfaminimumpolicy?language=objc)
104#[deprecated = "OpenGL API deprecated; please use Metal and MetalKit.  (Define GL_SILENCE_DEPRECATION to silence these warnings.)"]
105pub const NSOpenGLPFAMinimumPolicy: c_uint = 51;
106/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglpfamaximumpolicy?language=objc)
107#[deprecated = "OpenGL API deprecated; please use Metal and MetalKit.  (Define GL_SILENCE_DEPRECATION to silence these warnings.)"]
108pub const NSOpenGLPFAMaximumPolicy: c_uint = 52;
109/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglpfasamplebuffers?language=objc)
110#[deprecated = "OpenGL API deprecated; please use Metal and MetalKit.  (Define GL_SILENCE_DEPRECATION to silence these warnings.)"]
111pub const NSOpenGLPFASampleBuffers: c_uint = 55;
112/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglpfasamples?language=objc)
113#[deprecated = "OpenGL API deprecated; please use Metal and MetalKit.  (Define GL_SILENCE_DEPRECATION to silence these warnings.)"]
114pub const NSOpenGLPFASamples: c_uint = 56;
115/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglpfaauxdepthstencil?language=objc)
116#[deprecated = "OpenGL API deprecated; please use Metal and MetalKit.  (Define GL_SILENCE_DEPRECATION to silence these warnings.)"]
117pub const NSOpenGLPFAAuxDepthStencil: c_uint = 57;
118/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglpfacolorfloat?language=objc)
119#[deprecated = "OpenGL API deprecated; please use Metal and MetalKit.  (Define GL_SILENCE_DEPRECATION to silence these warnings.)"]
120pub const NSOpenGLPFAColorFloat: c_uint = 58;
121/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglpfamultisample?language=objc)
122#[deprecated = "OpenGL API deprecated; please use Metal and MetalKit.  (Define GL_SILENCE_DEPRECATION to silence these warnings.)"]
123pub const NSOpenGLPFAMultisample: c_uint = 59;
124/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglpfasupersample?language=objc)
125#[deprecated = "OpenGL API deprecated; please use Metal and MetalKit.  (Define GL_SILENCE_DEPRECATION to silence these warnings.)"]
126pub const NSOpenGLPFASupersample: c_uint = 60;
127/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglpfasamplealpha?language=objc)
128#[deprecated = "OpenGL API deprecated; please use Metal and MetalKit.  (Define GL_SILENCE_DEPRECATION to silence these warnings.)"]
129pub const NSOpenGLPFASampleAlpha: c_uint = 61;
130/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglpfarendererid?language=objc)
131#[deprecated = "OpenGL API deprecated; please use Metal and MetalKit.  (Define GL_SILENCE_DEPRECATION to silence these warnings.)"]
132pub const NSOpenGLPFARendererID: c_uint = 70;
133/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglpfanorecovery?language=objc)
134#[deprecated = "OpenGL API deprecated; please use Metal and MetalKit.  (Define GL_SILENCE_DEPRECATION to silence these warnings.)"]
135pub const NSOpenGLPFANoRecovery: c_uint = 72;
136/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglpfaaccelerated?language=objc)
137#[deprecated = "OpenGL API deprecated; please use Metal and MetalKit.  (Define GL_SILENCE_DEPRECATION to silence these warnings.)"]
138pub const NSOpenGLPFAAccelerated: c_uint = 73;
139/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglpfaclosestpolicy?language=objc)
140#[deprecated = "OpenGL API deprecated; please use Metal and MetalKit.  (Define GL_SILENCE_DEPRECATION to silence these warnings.)"]
141pub const NSOpenGLPFAClosestPolicy: c_uint = 74;
142/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglpfabackingstore?language=objc)
143#[deprecated = "OpenGL API deprecated; please use Metal and MetalKit.  (Define GL_SILENCE_DEPRECATION to silence these warnings.)"]
144pub const NSOpenGLPFABackingStore: c_uint = 76;
145/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglpfascreenmask?language=objc)
146#[deprecated = "OpenGL API deprecated; please use Metal and MetalKit.  (Define GL_SILENCE_DEPRECATION to silence these warnings.)"]
147pub const NSOpenGLPFAScreenMask: c_uint = 84;
148/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglpfaallowofflinerenderers?language=objc)
149#[deprecated = "OpenGL API deprecated; please use Metal and MetalKit.  (Define GL_SILENCE_DEPRECATION to silence these warnings.)"]
150pub const NSOpenGLPFAAllowOfflineRenderers: c_uint = 96;
151/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglpfaacceleratedcompute?language=objc)
152#[deprecated = "OpenGL API deprecated; please use Metal and MetalKit.  (Define GL_SILENCE_DEPRECATION to silence these warnings.)"]
153pub const NSOpenGLPFAAcceleratedCompute: c_uint = 97;
154/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglpfaopenglprofile?language=objc)
155#[deprecated = "OpenGL API deprecated; please use Metal and MetalKit.  (Define GL_SILENCE_DEPRECATION to silence these warnings.)"]
156pub const NSOpenGLPFAOpenGLProfile: c_uint = 99;
157/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglpfavirtualscreencount?language=objc)
158#[deprecated = "OpenGL API deprecated; please use Metal and MetalKit.  (Define GL_SILENCE_DEPRECATION to silence these warnings.)"]
159pub const NSOpenGLPFAVirtualScreenCount: c_uint = 128;
160/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglpfastereo?language=objc)
161#[deprecated]
162pub const NSOpenGLPFAStereo: c_uint = 6;
163/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglpfaoffscreen?language=objc)
164#[deprecated]
165pub const NSOpenGLPFAOffScreen: c_uint = 53;
166/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglpfafullscreen?language=objc)
167#[deprecated]
168pub const NSOpenGLPFAFullScreen: c_uint = 54;
169/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglpfasinglerenderer?language=objc)
170#[deprecated]
171pub const NSOpenGLPFASingleRenderer: c_uint = 71;
172/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglpfarobust?language=objc)
173#[deprecated]
174pub const NSOpenGLPFARobust: c_uint = 75;
175/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglpfampsafe?language=objc)
176#[deprecated]
177pub const NSOpenGLPFAMPSafe: c_uint = 78;
178/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglpfawindow?language=objc)
179#[deprecated]
180pub const NSOpenGLPFAWindow: c_uint = 80;
181/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglpfamultiscreen?language=objc)
182#[deprecated]
183pub const NSOpenGLPFAMultiScreen: c_uint = 81;
184/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglpfacompliant?language=objc)
185#[deprecated]
186pub const NSOpenGLPFACompliant: c_uint = 83;
187/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglpfapixelbuffer?language=objc)
188#[deprecated]
189pub const NSOpenGLPFAPixelBuffer: c_uint = 90;
190/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglpfaremotepixelbuffer?language=objc)
191#[deprecated]
192pub const NSOpenGLPFARemotePixelBuffer: c_uint = 91;
193
194/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglpixelformatattribute?language=objc)
195#[deprecated = "OpenGL API deprecated; please use Metal and MetalKit.  (Define GL_SILENCE_DEPRECATION to silence these warnings.)"]
196pub type NSOpenGLPixelFormatAttribute = u32;
197
198/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglprofileversionlegacy?language=objc)
199#[deprecated = "OpenGL API deprecated; please use Metal and MetalKit.  (Define GL_SILENCE_DEPRECATION to silence these warnings.)"]
200pub const NSOpenGLProfileVersionLegacy: c_uint = 0x1000;
201/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglprofileversion3_2core?language=objc)
202#[deprecated = "OpenGL API deprecated; please use Metal and MetalKit.  (Define GL_SILENCE_DEPRECATION to silence these warnings.)"]
203pub const NSOpenGLProfileVersion3_2Core: c_uint = 0x3200;
204/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglprofileversion4_1core?language=objc)
205#[deprecated = "OpenGL API deprecated; please use Metal and MetalKit.  (Define GL_SILENCE_DEPRECATION to silence these warnings.)"]
206pub const NSOpenGLProfileVersion4_1Core: c_uint = 0x4100;
207
208extern_class!(
209    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglpixelformat?language=objc)
210    #[unsafe(super(NSObject))]
211    #[derive(Debug, PartialEq, Eq, Hash)]
212    #[deprecated = "Please use Metal or MetalKit."]
213    pub struct NSOpenGLPixelFormat;
214);
215
216extern_conformance!(
217    unsafe impl NSCoding for NSOpenGLPixelFormat {}
218);
219
220extern_conformance!(
221    unsafe impl NSObjectProtocol for NSOpenGLPixelFormat {}
222);
223
224impl NSOpenGLPixelFormat {
225    extern_methods!(
226        #[cfg(feature = "objc2-open-gl")]
227        #[cfg(target_vendor = "apple")]
228        /// # Safety
229        ///
230        /// `format` must be a valid pointer.
231        #[unsafe(method(initWithCGLPixelFormatObj:))]
232        #[unsafe(method_family = init)]
233        pub unsafe fn initWithCGLPixelFormatObj(
234            this: Allocated<Self>,
235            format: CGLPixelFormatObj,
236        ) -> Option<Retained<NSOpenGLPixelFormat>>;
237
238        /// # Safety
239        ///
240        /// `attribs` must be a valid pointer.
241        #[unsafe(method(initWithAttributes:))]
242        #[unsafe(method_family = init)]
243        pub unsafe fn initWithAttributes(
244            this: Allocated<Self>,
245            attribs: NonNull<NSOpenGLPixelFormatAttribute>,
246        ) -> Option<Retained<Self>>;
247
248        /// # Safety
249        ///
250        /// `attribs` might not allow `None`.
251        #[deprecated = "Use -initWithAttributes: instead"]
252        #[unsafe(method(initWithData:))]
253        #[unsafe(method_family = init)]
254        pub unsafe fn initWithData(
255            this: Allocated<Self>,
256            attribs: Option<&NSData>,
257        ) -> Option<Retained<Self>>;
258
259        #[deprecated]
260        #[unsafe(method(attributes))]
261        #[unsafe(method_family = none)]
262        pub fn attributes(&self) -> Option<Retained<NSData>>;
263
264        /// # Safety
265        ///
266        /// `attribs` might not allow `None`.
267        #[deprecated]
268        #[unsafe(method(setAttributes:))]
269        #[unsafe(method_family = none)]
270        pub unsafe fn setAttributes(&self, attribs: Option<&NSData>);
271
272        #[cfg(feature = "objc2-open-gl")]
273        #[cfg(target_vendor = "apple")]
274        /// # Safety
275        ///
276        /// `vals` must be a valid pointer.
277        #[unsafe(method(getValues:forAttribute:forVirtualScreen:))]
278        #[unsafe(method_family = none)]
279        pub unsafe fn getValues_forAttribute_forVirtualScreen(
280            &self,
281            vals: NonNull<GLint>,
282            attrib: NSOpenGLPixelFormatAttribute,
283            screen: GLint,
284        );
285
286        #[cfg(feature = "objc2-open-gl")]
287        #[cfg(target_vendor = "apple")]
288        #[unsafe(method(numberOfVirtualScreens))]
289        #[unsafe(method_family = none)]
290        pub fn numberOfVirtualScreens(&self) -> GLint;
291
292        #[cfg(feature = "objc2-open-gl")]
293        #[cfg(target_vendor = "apple")]
294        #[unsafe(method(CGLPixelFormatObj))]
295        #[unsafe(method_family = none)]
296        pub fn CGLPixelFormatObj(&self) -> CGLPixelFormatObj;
297    );
298}
299
300/// Methods declared on superclass `NSObject`.
301impl NSOpenGLPixelFormat {
302    extern_methods!(
303        #[unsafe(method(init))]
304        #[unsafe(method_family = init)]
305        pub fn init(this: Allocated<Self>) -> Retained<Self>;
306
307        #[unsafe(method(new))]
308        #[unsafe(method_family = new)]
309        pub fn new() -> Retained<Self>;
310    );
311}
312
313impl DefaultRetained for NSOpenGLPixelFormat {
314    #[inline]
315    fn default_retained() -> Retained<Self> {
316        Self::new()
317    }
318}
319
320extern_class!(
321    /// *******************
322    /// * NSOpenGLPixelBuffer
323    /// *******************
324    ///
325    /// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglpixelbuffer?language=objc)
326    #[unsafe(super(NSObject))]
327    #[derive(Debug, PartialEq, Eq, Hash)]
328    #[deprecated = "Use GL_EXT_framebuffer_object instead"]
329    pub struct NSOpenGLPixelBuffer;
330);
331
332extern_conformance!(
333    unsafe impl NSObjectProtocol for NSOpenGLPixelBuffer {}
334);
335
336impl NSOpenGLPixelBuffer {
337    extern_methods!(
338        #[cfg(feature = "objc2-open-gl")]
339        #[cfg(target_vendor = "apple")]
340        #[deprecated]
341        #[unsafe(method(initWithTextureTarget:textureInternalFormat:textureMaxMipMapLevel:pixelsWide:pixelsHigh:))]
342        #[unsafe(method_family = init)]
343        pub fn initWithTextureTarget_textureInternalFormat_textureMaxMipMapLevel_pixelsWide_pixelsHigh(
344            this: Allocated<Self>,
345            target: GLenum,
346            format: GLenum,
347            max_level: GLint,
348            pixels_wide: GLsizei,
349            pixels_high: GLsizei,
350        ) -> Option<Retained<Self>>;
351
352        #[cfg(feature = "objc2-open-gl")]
353        #[cfg(target_vendor = "apple")]
354        /// # Safety
355        ///
356        /// `pbuffer` must be a valid pointer.
357        #[deprecated]
358        #[unsafe(method(initWithCGLPBufferObj:))]
359        #[unsafe(method_family = init)]
360        pub unsafe fn initWithCGLPBufferObj(
361            this: Allocated<Self>,
362            pbuffer: CGLPBufferObj,
363        ) -> Option<Retained<NSOpenGLPixelBuffer>>;
364
365        #[cfg(feature = "objc2-open-gl")]
366        #[cfg(target_vendor = "apple")]
367        #[unsafe(method(CGLPBufferObj))]
368        #[unsafe(method_family = none)]
369        pub fn CGLPBufferObj(&self) -> CGLPBufferObj;
370
371        #[cfg(feature = "objc2-open-gl")]
372        #[cfg(target_vendor = "apple")]
373        #[deprecated]
374        #[unsafe(method(pixelsWide))]
375        #[unsafe(method_family = none)]
376        pub fn pixelsWide(&self) -> GLsizei;
377
378        #[cfg(feature = "objc2-open-gl")]
379        #[cfg(target_vendor = "apple")]
380        #[deprecated]
381        #[unsafe(method(pixelsHigh))]
382        #[unsafe(method_family = none)]
383        pub fn pixelsHigh(&self) -> GLsizei;
384
385        #[cfg(feature = "objc2-open-gl")]
386        #[cfg(target_vendor = "apple")]
387        #[deprecated]
388        #[unsafe(method(textureTarget))]
389        #[unsafe(method_family = none)]
390        pub fn textureTarget(&self) -> GLenum;
391
392        #[cfg(feature = "objc2-open-gl")]
393        #[cfg(target_vendor = "apple")]
394        #[deprecated]
395        #[unsafe(method(textureInternalFormat))]
396        #[unsafe(method_family = none)]
397        pub fn textureInternalFormat(&self) -> GLenum;
398
399        #[cfg(feature = "objc2-open-gl")]
400        #[cfg(target_vendor = "apple")]
401        #[deprecated]
402        #[unsafe(method(textureMaxMipMapLevel))]
403        #[unsafe(method_family = none)]
404        pub fn textureMaxMipMapLevel(&self) -> GLint;
405    );
406}
407
408/// Methods declared on superclass `NSObject`.
409impl NSOpenGLPixelBuffer {
410    extern_methods!(
411        #[unsafe(method(init))]
412        #[unsafe(method_family = init)]
413        pub fn init(this: Allocated<Self>) -> Retained<Self>;
414
415        #[unsafe(method(new))]
416        #[unsafe(method_family = new)]
417        pub fn new() -> Retained<Self>;
418    );
419}
420
421impl DefaultRetained for NSOpenGLPixelBuffer {
422    #[inline]
423    fn default_retained() -> Retained<Self> {
424        Self::new()
425    }
426}
427
428/// ***************
429/// * NSOpenGLContext
430/// ***************
431///
432/// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglcontextparameter?language=objc)
433// NS_ENUM
434#[deprecated = "OpenGL API deprecated; please use Metal and MetalKit.  (Define GL_SILENCE_DEPRECATION to silence these warnings.)"]
435#[repr(transparent)]
436#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
437pub struct NSOpenGLContextParameter(pub NSInteger);
438impl NSOpenGLContextParameter {
439    #[doc(alias = "NSOpenGLContextParameterSwapInterval")]
440    #[deprecated = "OpenGL API deprecated; please use Metal and MetalKit.  (Define GL_SILENCE_DEPRECATION to silence these warnings.)"]
441    pub const SwapInterval: Self = Self(222);
442    #[doc(alias = "NSOpenGLContextParameterSurfaceOrder")]
443    #[deprecated = "OpenGL API deprecated; please use Metal and MetalKit.  (Define GL_SILENCE_DEPRECATION to silence these warnings.)"]
444    pub const SurfaceOrder: Self = Self(235);
445    #[doc(alias = "NSOpenGLContextParameterSurfaceOpacity")]
446    #[deprecated = "OpenGL API deprecated; please use Metal and MetalKit.  (Define GL_SILENCE_DEPRECATION to silence these warnings.)"]
447    pub const SurfaceOpacity: Self = Self(236);
448    #[doc(alias = "NSOpenGLContextParameterSurfaceBackingSize")]
449    #[deprecated = "OpenGL API deprecated; please use Metal and MetalKit.  (Define GL_SILENCE_DEPRECATION to silence these warnings.)"]
450    pub const SurfaceBackingSize: Self = Self(304);
451    #[doc(alias = "NSOpenGLContextParameterReclaimResources")]
452    #[deprecated = "OpenGL API deprecated; please use Metal and MetalKit.  (Define GL_SILENCE_DEPRECATION to silence these warnings.)"]
453    pub const ReclaimResources: Self = Self(308);
454    #[doc(alias = "NSOpenGLContextParameterCurrentRendererID")]
455    #[deprecated = "OpenGL API deprecated; please use Metal and MetalKit.  (Define GL_SILENCE_DEPRECATION to silence these warnings.)"]
456    pub const CurrentRendererID: Self = Self(309);
457    #[doc(alias = "NSOpenGLContextParameterGPUVertexProcessing")]
458    #[deprecated = "OpenGL API deprecated; please use Metal and MetalKit.  (Define GL_SILENCE_DEPRECATION to silence these warnings.)"]
459    pub const GPUVertexProcessing: Self = Self(310);
460    #[doc(alias = "NSOpenGLContextParameterGPUFragmentProcessing")]
461    #[deprecated = "OpenGL API deprecated; please use Metal and MetalKit.  (Define GL_SILENCE_DEPRECATION to silence these warnings.)"]
462    pub const GPUFragmentProcessing: Self = Self(311);
463    #[doc(alias = "NSOpenGLContextParameterHasDrawable")]
464    #[deprecated = "OpenGL API deprecated; please use Metal and MetalKit.  (Define GL_SILENCE_DEPRECATION to silence these warnings.)"]
465    pub const HasDrawable: Self = Self(314);
466    #[doc(alias = "NSOpenGLContextParameterMPSwapsInFlight")]
467    #[deprecated = "OpenGL API deprecated; please use Metal and MetalKit.  (Define GL_SILENCE_DEPRECATION to silence these warnings.)"]
468    pub const MPSwapsInFlight: Self = Self(315);
469    #[doc(alias = "NSOpenGLContextParameterSwapRectangle")]
470    #[deprecated]
471    pub const SwapRectangle: Self = Self(200);
472    #[doc(alias = "NSOpenGLContextParameterSwapRectangleEnable")]
473    #[deprecated]
474    pub const SwapRectangleEnable: Self = Self(201);
475    #[doc(alias = "NSOpenGLContextParameterRasterizationEnable")]
476    #[deprecated]
477    pub const RasterizationEnable: Self = Self(221);
478    #[doc(alias = "NSOpenGLContextParameterStateValidation")]
479    #[deprecated]
480    pub const StateValidation: Self = Self(301);
481    #[doc(alias = "NSOpenGLContextParameterSurfaceSurfaceVolatile")]
482    #[deprecated]
483    pub const SurfaceSurfaceVolatile: Self = Self(306);
484}
485
486unsafe impl Encode for NSOpenGLContextParameter {
487    const ENCODING: Encoding = NSInteger::ENCODING;
488}
489
490unsafe impl RefEncode for NSOpenGLContextParameter {
491    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
492}
493
494extern_class!(
495    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglcontext?language=objc)
496    #[unsafe(super(NSObject))]
497    #[derive(Debug, PartialEq, Eq, Hash)]
498    #[deprecated = "Please use Metal or MetalKit."]
499    pub struct NSOpenGLContext;
500);
501
502extern_conformance!(
503    unsafe impl NSLocking for NSOpenGLContext {}
504);
505
506extern_conformance!(
507    unsafe impl NSObjectProtocol for NSOpenGLContext {}
508);
509
510impl NSOpenGLContext {
511    extern_methods!(
512        #[unsafe(method(initWithFormat:shareContext:))]
513        #[unsafe(method_family = init)]
514        pub fn initWithFormat_shareContext(
515            this: Allocated<Self>,
516            format: &NSOpenGLPixelFormat,
517            share: Option<&NSOpenGLContext>,
518        ) -> Option<Retained<Self>>;
519
520        #[cfg(feature = "objc2-open-gl")]
521        #[cfg(target_vendor = "apple")]
522        /// # Safety
523        ///
524        /// `context` must be a valid pointer.
525        #[unsafe(method(initWithCGLContextObj:))]
526        #[unsafe(method_family = init)]
527        pub unsafe fn initWithCGLContextObj(
528            this: Allocated<Self>,
529            context: CGLContextObj,
530        ) -> Option<Retained<NSOpenGLContext>>;
531
532        #[unsafe(method(pixelFormat))]
533        #[unsafe(method_family = none)]
534        pub fn pixelFormat(&self) -> Retained<NSOpenGLPixelFormat>;
535
536        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
537        #[deprecated]
538        #[unsafe(method(view))]
539        #[unsafe(method_family = none)]
540        pub fn view(&self, mtm: MainThreadMarker) -> Option<Retained<NSView>>;
541
542        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
543        /// Setter for [`view`][Self::view].
544        ///
545        /// This is a [weak property][objc2::topics::weak_property].
546        #[deprecated]
547        #[unsafe(method(setView:))]
548        #[unsafe(method_family = none)]
549        pub fn setView(&self, view: Option<&NSView>, mtm: MainThreadMarker);
550
551        #[deprecated = "Use a fullscreen NSOpenGLView instead"]
552        #[unsafe(method(setFullScreen))]
553        #[unsafe(method_family = none)]
554        pub fn setFullScreen(&self);
555
556        #[cfg(feature = "objc2-open-gl")]
557        #[cfg(target_vendor = "apple")]
558        /// # Safety
559        ///
560        /// `baseaddr` must be a valid pointer.
561        #[deprecated]
562        #[unsafe(method(setOffScreen:width:height:rowbytes:))]
563        #[unsafe(method_family = none)]
564        pub unsafe fn setOffScreen_width_height_rowbytes(
565            &self,
566            baseaddr: NonNull<c_void>,
567            width: GLsizei,
568            height: GLsizei,
569            rowbytes: GLint,
570        );
571
572        #[unsafe(method(clearDrawable))]
573        #[unsafe(method_family = none)]
574        pub fn clearDrawable(&self);
575
576        #[unsafe(method(update))]
577        #[unsafe(method_family = none)]
578        pub fn update(&self, mtm: MainThreadMarker);
579
580        #[unsafe(method(flushBuffer))]
581        #[unsafe(method_family = none)]
582        pub fn flushBuffer(&self);
583
584        #[unsafe(method(makeCurrentContext))]
585        #[unsafe(method_family = none)]
586        pub fn makeCurrentContext(&self);
587
588        #[unsafe(method(clearCurrentContext))]
589        #[unsafe(method_family = none)]
590        pub fn clearCurrentContext();
591
592        #[unsafe(method(currentContext))]
593        #[unsafe(method_family = none)]
594        pub fn currentContext() -> Option<Retained<NSOpenGLContext>>;
595
596        #[cfg(feature = "objc2-open-gl")]
597        #[cfg(target_vendor = "apple")]
598        #[deprecated]
599        #[unsafe(method(copyAttributesFromContext:withMask:))]
600        #[unsafe(method_family = none)]
601        pub fn copyAttributesFromContext_withMask(
602            &self,
603            context: &NSOpenGLContext,
604            mask: GLbitfield,
605        );
606
607        #[cfg(feature = "objc2-open-gl")]
608        #[cfg(target_vendor = "apple")]
609        /// # Safety
610        ///
611        /// `vals` must be a valid pointer.
612        #[unsafe(method(setValues:forParameter:))]
613        #[unsafe(method_family = none)]
614        pub unsafe fn setValues_forParameter(
615            &self,
616            vals: NonNull<GLint>,
617            param: NSOpenGLContextParameter,
618        );
619
620        #[cfg(feature = "objc2-open-gl")]
621        #[cfg(target_vendor = "apple")]
622        /// # Safety
623        ///
624        /// `vals` must be a valid pointer.
625        #[unsafe(method(getValues:forParameter:))]
626        #[unsafe(method_family = none)]
627        pub unsafe fn getValues_forParameter(
628            &self,
629            vals: NonNull<GLint>,
630            param: NSOpenGLContextParameter,
631        );
632
633        #[cfg(feature = "objc2-open-gl")]
634        #[cfg(target_vendor = "apple")]
635        #[unsafe(method(currentVirtualScreen))]
636        #[unsafe(method_family = none)]
637        pub fn currentVirtualScreen(&self) -> GLint;
638
639        #[cfg(feature = "objc2-open-gl")]
640        #[cfg(target_vendor = "apple")]
641        /// Setter for [`currentVirtualScreen`][Self::currentVirtualScreen].
642        #[unsafe(method(setCurrentVirtualScreen:))]
643        #[unsafe(method_family = none)]
644        pub fn setCurrentVirtualScreen(&self, current_virtual_screen: GLint);
645
646        #[cfg(all(feature = "NSResponder", feature = "NSView", feature = "objc2-open-gl"))]
647        #[cfg(target_vendor = "apple")]
648        #[deprecated]
649        #[unsafe(method(createTexture:fromView:internalFormat:))]
650        #[unsafe(method_family = none)]
651        pub fn createTexture_fromView_internalFormat(
652            &self,
653            target: GLenum,
654            view: &NSView,
655            format: GLenum,
656        );
657
658        #[cfg(feature = "objc2-open-gl")]
659        #[cfg(target_vendor = "apple")]
660        #[unsafe(method(CGLContextObj))]
661        #[unsafe(method_family = none)]
662        pub fn CGLContextObj(&self) -> CGLContextObj;
663    );
664}
665
666/// Methods declared on superclass `NSObject`.
667impl NSOpenGLContext {
668    extern_methods!(
669        #[unsafe(method(init))]
670        #[unsafe(method_family = init)]
671        pub fn init(this: Allocated<Self>) -> Retained<Self>;
672
673        #[unsafe(method(new))]
674        #[unsafe(method_family = new)]
675        pub fn new() -> Retained<Self>;
676    );
677}
678
679impl DefaultRetained for NSOpenGLContext {
680    #[inline]
681    fn default_retained() -> Retained<Self> {
682        Self::new()
683    }
684}
685
686/// NSOpenGLPixelBuffer.
687impl NSOpenGLContext {
688    extern_methods!(
689        #[cfg(feature = "objc2-open-gl")]
690        #[cfg(target_vendor = "apple")]
691        #[deprecated]
692        #[unsafe(method(setPixelBuffer:cubeMapFace:mipMapLevel:currentVirtualScreen:))]
693        #[unsafe(method_family = none)]
694        pub fn setPixelBuffer_cubeMapFace_mipMapLevel_currentVirtualScreen(
695            &self,
696            pixel_buffer: &NSOpenGLPixelBuffer,
697            face: GLenum,
698            level: GLint,
699            screen: GLint,
700        );
701
702        #[deprecated]
703        #[unsafe(method(pixelBuffer))]
704        #[unsafe(method_family = none)]
705        pub fn pixelBuffer(&self) -> Option<Retained<NSOpenGLPixelBuffer>>;
706
707        #[cfg(feature = "objc2-open-gl")]
708        #[cfg(target_vendor = "apple")]
709        #[deprecated]
710        #[unsafe(method(pixelBufferCubeMapFace))]
711        #[unsafe(method_family = none)]
712        pub fn pixelBufferCubeMapFace(&self) -> GLenum;
713
714        #[cfg(feature = "objc2-open-gl")]
715        #[cfg(target_vendor = "apple")]
716        #[deprecated]
717        #[unsafe(method(pixelBufferMipMapLevel))]
718        #[unsafe(method_family = none)]
719        pub fn pixelBufferMipMapLevel(&self) -> GLint;
720
721        #[cfg(feature = "objc2-open-gl")]
722        #[cfg(target_vendor = "apple")]
723        #[deprecated]
724        #[unsafe(method(setTextureImageToPixelBuffer:colorBuffer:))]
725        #[unsafe(method_family = none)]
726        pub fn setTextureImageToPixelBuffer_colorBuffer(
727            &self,
728            pixel_buffer: &NSOpenGLPixelBuffer,
729            source: GLenum,
730        );
731    );
732}
733
734/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglcpswapinterval?language=objc)
735#[deprecated]
736pub static NSOpenGLCPSwapInterval: NSOpenGLContextParameter =
737    NSOpenGLContextParameter(NSOpenGLContextParameter::SwapInterval.0);
738
739/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglcpsurfaceorder?language=objc)
740#[deprecated]
741pub static NSOpenGLCPSurfaceOrder: NSOpenGLContextParameter =
742    NSOpenGLContextParameter(NSOpenGLContextParameter::SurfaceOrder.0);
743
744/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglcpsurfaceopacity?language=objc)
745#[deprecated]
746pub static NSOpenGLCPSurfaceOpacity: NSOpenGLContextParameter =
747    NSOpenGLContextParameter(NSOpenGLContextParameter::SurfaceOpacity.0);
748
749/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglcpsurfacebackingsize?language=objc)
750#[deprecated]
751pub static NSOpenGLCPSurfaceBackingSize: NSOpenGLContextParameter =
752    NSOpenGLContextParameter(NSOpenGLContextParameter::SurfaceBackingSize.0);
753
754/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglcpreclaimresources?language=objc)
755#[deprecated]
756pub static NSOpenGLCPReclaimResources: NSOpenGLContextParameter =
757    NSOpenGLContextParameter(NSOpenGLContextParameter::ReclaimResources.0);
758
759/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglcpcurrentrendererid?language=objc)
760#[deprecated]
761pub static NSOpenGLCPCurrentRendererID: NSOpenGLContextParameter =
762    NSOpenGLContextParameter(NSOpenGLContextParameter::CurrentRendererID.0);
763
764/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglcpgpuvertexprocessing?language=objc)
765#[deprecated]
766pub static NSOpenGLCPGPUVertexProcessing: NSOpenGLContextParameter =
767    NSOpenGLContextParameter(NSOpenGLContextParameter::GPUVertexProcessing.0);
768
769/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglcpgpufragmentprocessing?language=objc)
770#[deprecated]
771pub static NSOpenGLCPGPUFragmentProcessing: NSOpenGLContextParameter =
772    NSOpenGLContextParameter(NSOpenGLContextParameter::GPUFragmentProcessing.0);
773
774/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglcphasdrawable?language=objc)
775#[deprecated]
776pub static NSOpenGLCPHasDrawable: NSOpenGLContextParameter =
777    NSOpenGLContextParameter(NSOpenGLContextParameter::HasDrawable.0);
778
779/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglcpmpswapsinflight?language=objc)
780#[deprecated]
781pub static NSOpenGLCPMPSwapsInFlight: NSOpenGLContextParameter =
782    NSOpenGLContextParameter(NSOpenGLContextParameter::MPSwapsInFlight.0);
783
784/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglcpswaprectangle?language=objc)
785#[deprecated]
786pub static NSOpenGLCPSwapRectangle: NSOpenGLContextParameter =
787    NSOpenGLContextParameter(NSOpenGLContextParameter::SwapRectangle.0);
788
789/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglcpswaprectangleenable?language=objc)
790#[deprecated]
791pub static NSOpenGLCPSwapRectangleEnable: NSOpenGLContextParameter =
792    NSOpenGLContextParameter(NSOpenGLContextParameter::SwapRectangleEnable.0);
793
794/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglcprasterizationenable?language=objc)
795#[deprecated]
796pub static NSOpenGLCPRasterizationEnable: NSOpenGLContextParameter =
797    NSOpenGLContextParameter(NSOpenGLContextParameter::RasterizationEnable.0);
798
799/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglcpstatevalidation?language=objc)
800#[deprecated]
801pub static NSOpenGLCPStateValidation: NSOpenGLContextParameter =
802    NSOpenGLContextParameter(NSOpenGLContextParameter::StateValidation.0);
803
804/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglcpsurfacesurfacevolatile?language=objc)
805#[deprecated]
806pub static NSOpenGLCPSurfaceSurfaceVolatile: NSOpenGLContextParameter =
807    NSOpenGLContextParameter(NSOpenGLContextParameter::SurfaceSurfaceVolatile.0);