bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [win32] opengl - not NSWindow


From: Fred Kiefer
Subject: Re: [win32] opengl - not NSWindow
Date: Fri, 13 Feb 2009 10:18:31 +0100
User-agent: Thunderbird 2.0.0.19 (X11/20081227)

Looks like you are creating an OpenGL context and a view without a
corresponding window. This wont work in GNUstep (it might on MacOSX, I
don't know) and it would be useless anyway, as you wont be able to see
anything in that view.

You better start off by copying one of the OpenGL example applications
and add your changes there.

Fred

Julien Isorce wrote:
> Hi,
> 
> The following minimal code fails.
> I got the error:
> 
>  w32_GLcontext.m:112  Assertion failed in Win32Subwindow(instance),
> method initWithView:.
>  request of a window attachment on a view that is not on a NSWindow.
> 
> I tried to debug it in parsing gnustep gui and backend sources.
> I found that it fails when setting the opengl context, just before
> calling  CreateWindow (win32 function).
> It exactly fails on this:  [glview window], I mean it returns nil.
> I think maybe something is wrong in NSView::initWithFrame, the _window
> member is not initialized.
> mhh I was not able to find where this _window member of NSView is
> initialized.
> 
> Maybe I have (again) not initialized something.
> 
> Any idea ? (sample code at the end of this mail)
> 
> Sincerely
> 
> Julien
> 
> ------------------------------------------------------------- test.m
> ------------------------------
> #include <Cocoa/Cocoa.h>
> #include <Foundation/NSAutoreleasePool.h>
> 
> int
> main (void)
> {
>   CREATE_AUTORELEASE_POOL(pool);
>   [NSApplication sharedApplication];
> 
>   NSOpenGLPixelFormatAttribute attribs[] = {
>     NSOpenGLPFAAccelerated,
>     NSOpenGLPFANoRecovery,
>     NSOpenGLPFADoubleBuffer,
>     NSOpenGLPFAColorSize, 24,
>     NSOpenGLPFAAlphaSize, 8,
>     NSOpenGLPFADepthSize, 24,
>     NSOpenGLPFAWindow,
>     0
>   };
> 
>   NSOpenGLPixelFormat *fmt = [[NSOpenGLPixelFormat alloc]
> initWithAttributes:attribs];
>      
>   if (fmt == nil)
>     NSLog(@"fail create pixel format");
>    
>    
>   NSRect rect;
>   rect.origin.x = 0;
>   rect.origin.y = 0;
>   rect.size.width = 320;
>   rect.size.height = 240;
> 
>   NSOpenGLView* glview = [[NSOpenGLView alloc] initWithFrame:rect
> pixelFormat:fmt];
>  
>   if (glview == nil)
>     NSLog(@"fail to create opengl view");
>  
>   NSOpenGLContext* glcontext = [glview openGLContext];
>  
>   if (glcontext == nil)
>     NSLog(@"fail to retrieve gl context");
>  
>   DESTROY(pool);
>  
>   return 0;
> }
> 
> ------------------------------------------------------
> 
> my GNUmakefile::
> 
> include $(GNUSTEP_MAKEFILES)/common.make
> 
> TOOL_NAME = test
> test_OBJC_FILES = test.m
> 
> ADDITIONAL_OBJC_LIBS += -lgnustep-gui
> 
> include $(GNUSTEP_MAKEFILES)/tool.make





reply via email to

[Prev in Thread] Current Thread [Next in Thread]