Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Buttons, etc on top of NSOpenGLView?

Buttons, etc on top of NSOpenGLView?
Thread Tools
Dedicated MacNNer
Join Date: Nov 2000
Status: Offline
Reply With Quote
Sep 17, 2002, 02:55 AM
 
Hello ...


Is there a way to keep an NSOpenGLView from over-drawing buttons (and other elements), even when the view is below those elements?

Also, is there a way to make an NSOpenGLView transparent? I've tried setting the glClearColor with an alpha component of 0.0 and adding an isOpaque method that returns NO.


Thanks and regards,

DayLateDon
     
Mac Elite
Join Date: Feb 2001
Location: Vancouver, WA
Status: Offline
Reply With Quote
Sep 17, 2002, 03:13 PM
 
Thanks to 10.2 and QuartzExreme, yes.

For the first question, see /Developer/Examples/OpenGL/Cocoa/UnderlaySurface. For drawing an OpenGL view with partially transparent content "on top of" other views, do the same thing but reverse the SurfaceOrdering parameter you set on the NSOpenGLView instance. (At least, I think that's it, just off the top of my head.)
Rick Roe
icons.cx | weblog
     
Dedicated MacNNer
Join Date: Nov 2000
Status: Offline
Reply With Quote
Sep 18, 2002, 06:43 AM
 
Thanks.

One of the relevant lines of code from the sample project was missing from a snippet I'd found in the Apple OpenGL mailing list. I can now put buttons and such on top of NSOpenGLViews.

Unfortunately, now the stuff in the view doesn't draw; the view is simply filled in with white. (If I remove the layer-shifting code, it draws fine.) And the buttons, after being clicked, have noticeably darker borders. Ugly.

Moreover, drawing performance has taken an _terrible_ nose dive. Even though I can't see my animations, I can monitor them. And what I've monitored is that sequences that used to take less than 1 second now take close to 10. (This on my iMac 400.)


So ... I guess I can re-arrange elements so that they don't overlap the OpenGL view (but after having tailored my graphics resources and drawing routines to what is probably the best of all possible layouts, I really don't want to do this). Or I can chuck the OpenGL port and go back to Quartz drawing in a custom view (but after experiencing some of the power and flexibility of OpenGL, I really don't want to do this either).

Or, I can figure out how to draw a single OpenGL scene off-screen somewhere and paste portions of it into separate views that avoid areas where the buttons are. Is this easy?


Regards,

DayLateDon
     
Professional Poster
Join Date: Apr 2001
Location: Long Beach, CA
Status: Offline
Reply With Quote
Sep 18, 2002, 11:08 AM
 
The first thing to note as that the iMac 400 would not support Quartz Extreme. If this stuff is highly dependent on QE, that may be the source of your problem. For example: on my iBook, a can run screen savers just fine. However, if I try to run them in the background, it is so incredibly slow that the machine becomes virtually unuseable. Also, it doesn't look right. This works just fine on my G4 though. This MAY be a large part of the problem.

ACSA 10.4/10.3, ACTC 10.3, ACHDS 10.3
     
Dedicated MacNNer
Join Date: Nov 2000
Status: Offline
Reply With Quote
Sep 18, 2002, 12:20 PM
 
Hello ...


If the surface layer ordering solution really does depend upon Quartz Extreme for acceptable performance, then I can't use it. (Not only can I not develop with QE on my iMac, but the customer base for the released product would be cut dramatically.)



Any pointers on copying areas of a single OpenGL scene to different views?


DayLateDon
     
Junior Member
Join Date: Oct 2001
Status: Offline
Reply With Quote
Sep 18, 2002, 02:57 PM
 
In the AppKit documentation it recommends using a normal NSView and an NSOpenGLContext to draw within the view. I have used this and displayed NSImage's at the same time with no problem. I am not sure if it works with other objects but you may want to try this.

type r 503
I be that insane n***a from the psycho ward.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 01:47 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2