Difference between revisions of "Mac OS X Porting - OpenGL transitions/NSOpenGLView"

From Apache OpenOffice Wiki
Jump to: navigation, search
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
 
'''What is important with NSOpenGLView :'''  
 
'''What is important with NSOpenGLView :'''  
 +
 +
Warning:  this is objective C  :-)
  
 
Instance method ( i.e. static ): defaultPixelFormat
 
Instance method ( i.e. static ): defaultPixelFormat
Line 8: Line 10:
  
 
=> the initWithFrame has '''two''' parameters, and thus cannot be confused with the initWithFrame from NSView
 
=> the initWithFrame has '''two''' parameters, and thus cannot be confused with the initWithFrame from NSView
 +
 
=> there is no draw:(NSRect)aFrameRect , just use the one inherited from NSView
 
=> there is no draw:(NSRect)aFrameRect , just use the one inherited from NSView
  
Line 44: Line 47:
 
@end
 
@end
 
</pre>
 
</pre>
 +
[[Category:MacOSX]]

Latest revision as of 11:01, 16 December 2009

What is important with NSOpenGLView :

Warning: this is objective C  :-)

Instance method ( i.e. static ): defaultPixelFormat

other important information:

(id)initWithFrame:(NSRect)frameRect pixelFormat:(NSOpenGLPixelFormat*)format

=> the initWithFrame has two parameters, and thus cannot be confused with the initWithFrame from NSView

=> there is no draw:(NSRect)aFrameRect , just use the one inherited from NSView

To add an OpenGLView inside an NSView, simply (after created and correctly initialized both) do:

[myNSView addSubview:pOpenGLView]

More from NSOpenGLView.h ( from AppKit framework ):

@interface NSOpenGLView : NSView {
  @private
    NSOpenGLContext*     _openGLContext;
    NSOpenGLPixelFormat* _pixelFormat;
    unsigned long        _reserved1;
    unsigned long        _reserved2;
    unsigned long        _reserved3;
}

+ (NSOpenGLPixelFormat*)defaultPixelFormat;

- (id)initWithFrame:(NSRect)frameRect pixelFormat:(NSOpenGLPixelFormat*)format;

- (void)setOpenGLContext:(NSOpenGLContext*)context;
- (NSOpenGLContext*)openGLContext;
- (void)clearGLContext;

- (void)update;		// moved or resized
- (void)reshape;	// scrolled, moved or resized

- (void)setPixelFormat:(NSOpenGLPixelFormat*)pixelFormat;
- (NSOpenGLPixelFormat*)pixelFormat;

#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3
- (void)prepareOpenGL;
#endif
@end
Personal tools