[bug #25548] NSOpenGLContext can't -makeCurrentContext independently of NSOpenGLView.

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

[bug #25548] NSOpenGLContext can't -makeCurrentContext independently of NSOpenGLView.

npower

URL:
  <http://savannah.gnu.org/bugs/?25548>

                 Summary: NSOpenGLContext can't -makeCurrentContext
independently of NSOpenGLView.
                 Project: GNUstep
            Submitted by: ratmice
            Submitted on: Tue 10 Feb 2009 05:10:24 PM GMT
                Category: Backend
                Severity: 3 - Normal
              Item Group: Bug
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

i'm thinking this might be possible if we create the x window stuff currently
in XGXSubWindow in the NSOpenGLContext and then on -setView: call
XReparentWindow, instead of delaying until we have a parent to create the
XGXSubWindow for..

the -openGLContextWithShareContext: method here does this...

http://developer.apple.com/DOCUMENTATION/GraphicsImaging/Conceptual/OpenGL-MacProgGuide/opengl_contexts/chapter_7_section_4.html#//apple_ref/doc/uid/TP40001987-CH216-SW7






    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?25548>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/



_______________________________________________
Bug-gnustep mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/bug-gnustep
Reply | Threaded
Open this post in threaded view
|

[bug #25548] NSOpenGLContext can't -makeCurrentContext independently of NSOpenGLView.

npower

Follow-up Comment #1, bug #25548 (project gnustep):

The current GNUstep implementation allows only 'windowed context' (defined
with [-setView]). 'Off screen' and 'fullscreen' contexts will be implemented
sooner or later, and dont need any view or sub-window.

I dont know many about shared contexts. They look te be handled fine in
XGGLFormat.m

Could you please post some code that should work but does not ? Thanks!

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?25548>

_______________________________________________
  Message posté via/par Savannah
  http://savannah.gnu.org/



_______________________________________________
Bug-gnustep mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/bug-gnustep
Reply | Threaded
Open this post in threaded view
|

[bug #25548] NSOpenGLContext can't -makeCurrentContext independently of NSOpenGLView.

npower

Follow-up Comment #2, bug #25548 (project gnustep):

attached is a test program that shows what i'd like to do...

the problem being i'm drawing into NSOpenGLView using external renderer which
in turn uses

glxGetCurrentDrawable/glxGetCurrentContext

initialization of the external renderer takes a bit of time, so i'd rather do
it at startup rather than waiting to initialize the renderer until I open the
nib file which contains the NSOpenGLView

I don't have any code which says that it should work, but there is nothing in
the documentation which leads me to believe that it shouldn't work.


this page leads me to believe that NSOpenGLContext is usable outside of
NSOpenGLView though.

http://www.mikeash.com/?page=pyblog/nsopenglcontext-and-one-shot.html

so yeah, i don't know if this code should work, but it doesn't.


(file #17594)
    _______________________________________________________

Additional Item Attachment:

File name: contextTest-0.0.1.tar.gz       Size:0 KB


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?25548>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/



_______________________________________________
Bug-gnustep mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/bug-gnustep
Reply | Threaded
Open this post in threaded view
|

[bug #25548] NSOpenGLContext can't -makeCurrentContext independently of NSOpenGLView.

npower

Follow-up Comment #3, bug #25548 (project gnustep):

Incidentally I found a small bug in XGGLFormat. But this has nothing to do
with your problem :/

You cannot 'makeCurrent' a context that has not been attached to a drawable,
ie with [-setView:]. This is not a bug. You probably can not do that even with
glx functions.

If your renderer needs a drawable or a context to initialize itself, then you
have to wait for the View to be ready. I'm afraid you can not even create
programmatically your GLView, then re-parent it when your nib window is ready,
because the current implementation destroys the context when the view is moved
to an other window (this is new, not tested and may not be Cocoa-compatible)

Some suggestions :
* You may insert your NIB file in a programmatically created window that
contains a GLView. (dunno how to do that!)
* Split your NIB file : 1st load the GLView part, then initialize your
renderer, then load the remaining NIB.
* If you can change the context of your renderer _after_ initialization, you
may initialize it with a dummy context.

Hope this will help...

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?25548>

_______________________________________________
  Message posté via/par Savannah
  http://savannah.gnu.org/



_______________________________________________
Bug-gnustep mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/bug-gnustep
Reply | Threaded
Open this post in threaded view
|

[bug #25548] NSOpenGLContext can't -makeCurrentContext independently of NSOpenGLView.

npower

Update of bug #25548 (project gnustep):

              Item Group:                     Bug => None                  
                  Status:                    None => Invalid                
             Open/Closed:                    Open => Analyzed              


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?25548>

_______________________________________________
  Message posté via/par Savannah
  http://savannah.gnu.org/



_______________________________________________
Bug-gnustep mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/bug-gnustep
Reply | Threaded
Open this post in threaded view
|

[bug #25548] NSOpenGLContext can't -makeCurrentContext independently of NSOpenGLView.

npower

Follow-up Comment #4, bug #25548 (project gnustep):

here's a hack of a patch which implements this, works with my test & MyGL and
my program, it'll need lots cleaning up

Yeah, i know we need a drawable, but the drawable and the NSView are
relatively unrelated except they must share a display.

the views window must be the contexts parent to be displayed in the right
place, we can create the drawable before we are attached to an NSView and then
reparent it to get the view to draw in the right place...

theres a few ways to work around this, create the windows offscreen on
application load
this doesn't help me really, because one of the problems i've run into is
that things like NSOutlineView call -reloadData in initWithCoder: which makes
writing my dataSources a pain since I have to write checks in every method to
see if openGL has been initialized yet, because a call to the renderer before
it is initialized will crash it,

the other option is using multiple nib files, this involves creating an NSBox
and replacing those for every view which shares a window with my nib, besides
that I can't actually look at what my window will look like.

and I cannot change the context after initialization.

I really don't think that there is any proof that the test attached to this
bug shouldn't work, and it isn't documented as not working, and this patch
should show that it isn't impossible.... anyhow yes, I know it could be worked
around but none of those options really appeal to me

(and fwiw I don't really care if it isn't portable because hacking the
renderer to use glxGetCurrentContext isn't portable either).


(file #17599)
    _______________________________________________________

Additional Item Attachment:

File name: foo.diff                       Size:6 KB


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?25548>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/



_______________________________________________
Bug-gnustep mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/bug-gnustep
Reply | Threaded
Open this post in threaded view
|

[bug #25548] NSOpenGLContext can't -makeCurrentContext independently of NSOpenGLView.

npower

Update of bug #25548 (project gnustep):

                Severity:              3 - Normal => 2 - Minor              
                  Status:                 Invalid => Ready For Test        
             Assigned to:                    None => xgl                    
             Open/Closed:                Analyzed => In Test                

    _______________________________________________________

Follow-up Comment #5:

You can not create a sub-window in [GLView -initWithFormat...] because you
don't even know if the context will draw to a window. It might draw
fullscreen, or to a pixmap, or to a pixel buffer. You can not know before
[-setView:] or [-setFullscreen], etc.

But you can reparent a NSOpenGLView. As i said, the current (partial and not
tested) implementation destroy the glx context, that will be re-create on the
new window by the next [-openGLContext]. This (simple) behavior might be
wrong.

Please check the attached patches to the current trunk version. You should
then be able to reparent an NSOpenGLView without the context to be destroyed.

1. create the view [-initWithFrame:...] in an unmap or hidden window
2a. get the context and initialize your renderer
2b. load your nib file
3. add the view to your brand new window [-addSubview:]




(file #17606, file #17607)
    _______________________________________________________

Additional Item Attachment:

File name: back.diff                      Size:0 KB
File name: gui.diff                       Size:1 KB


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?25548>

_______________________________________________
  Message posté via/par Savannah
  http://savannah.gnu.org/



_______________________________________________
Bug-gnustep mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/bug-gnustep
Reply | Threaded
Open this post in threaded view
|

[bug #25548] NSOpenGLContext can't -makeCurrentContext independently of NSOpenGLView.

npower

Follow-up Comment #6, bug #25548 (project gnustep):

yes, I know (and I assume you meant NSOpenGLContext
-initWithFormat:sharedContext:)

that was a big reason why the patch was a hack, it was just easier for the
moment the idea was to do this in -makeCurrentContext

which will give the caller time to configure the context, but that is easier
said than done and going to require quite a bit of rework.


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?25548>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/



_______________________________________________
Bug-gnustep mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/bug-gnustep
Reply | Threaded
Open this post in threaded view
|

[bug #25548] NSOpenGLContext can't -makeCurrentContext independently of NSOpenGLView.

npower

Follow-up Comment #7, bug #25548 (project gnustep):

Here is a enhanced version of your contextTest. It demonstrates that my patch
is not so bad. I tried to mimic your needs but as i don't know anything about
nib file it needs some work.

(file #17612)
    _______________________________________________________

Additional Item Attachment:

File name: contextTest-0.0.2.tar.gz       Size:1 KB


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?25548>

_______________________________________________
  Message posté via/par Savannah
  http://savannah.gnu.org/



_______________________________________________
Bug-gnustep mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/bug-gnustep
Reply | Threaded
Open this post in threaded view
|

[bug #25548] NSOpenGLContext can't -makeCurrentContext independently of NSOpenGLView.

npower

Follow-up Comment #8, bug #25548 (project gnustep):

I've just tested Matt's contextTest v1 and v2 on Mac OSX 10.4:
* V1 does not output any message, but this does not mean it does something.
An extended test might help.
* V2 is (almost) ok : I think my patch might be port to Win32 and added to
the official backend, as it's a improvement in compatibility.

Matt : did you test my patch along with my suggestions in your project ?



    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?25548>

_______________________________________________
  Message posté via/par Savannah
  http://savannah.gnu.org/



_______________________________________________
Bug-gnustep mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/bug-gnustep
Reply | Threaded
Open this post in threaded view
|

[bug #25548] NSOpenGLContext can't -makeCurrentContext independently of NSOpenGLView.

npower
Follow-up Comment #9, bug #25548 (project gnustep):

Volunteers of the Federal Government Social Investment Programme Npower are
smiling to the bank as Npower pays January Stipend.

The payment commenced this morning as alerts from First City Monument Bank has
been spotted.

Volunteers of the scheme had been affected by the epileptic system of payment
which characterized the scheme last year.

With this development, volunteers can now work hard and contribute their quota
to the service they are assigned.

The 2016 batch of volunteers have also been paid as they await their exit
packages.

https://voiceofnigeria.org.ng/npower-stipend-news/
https://voiceofnigeria.org.ng/npower/

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?25548>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/


Reply | Threaded
Open this post in threaded view
|

[bug #25548] NSOpenGLContext can't -makeCurrentContext independently of NSOpenGLView.

npower
Follow-up Comment #10, bug #25548 (project gnustep):

The federal government of Nigeria has reduced the rate of unemployment through
the Npower programme. A step by step guide on how to apply for the Npower
recruitment has been provided. You can follow the link below.
https://bekeking.com/npower-recruitment/
https://bekeking.com/npower-stipend/

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?25548>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/