Search Results

Search found 34 results on 2 pages for 'dugla'.

Page 1/2 | 1 2  | Next Page >

  • iPad GLSL. From within a fragment shader how do I get the surface - not vertex - normal

    - by dugla
    Is it possible to access the surface normal - the normal associated with the plane of a fragment - from within a fragment shader? Or perhaps this can be done in the vertex shader? Is all knowledge of the associated geometry lost when we go down the shader pipeline or is there some clever way of recovering that information in either the vertex of fragment shader? Thanks in advance. Cheers, Doug twitter: @dugla

    Read the article

  • GLSL: How Do I cast a float into an int?

    - by dugla
    In a GLSL fragment shader I am trying to cast a float into an int. The compiler has other ideas. It complains thusly: ERROR: 0:60: '=' : cannot convert from 'mediump float' to 'highp int' I am trying to do this: mediump float indexf = floor(2.0 * mixer); highp int index = indexf; I (vainly) tried to raise the precision of the int above the float to appease the GL Gods but no joy. Could someone please school me here? Thanks, Doug

    Read the article

  • Why, on iOS, is glRenderbufferStorage appearing to fail?

    - by dugla
    On an iOS device (iPad) I decided to change the storage for my renderbuffer from the CAEAGLLayer that backs the view to explicit storage via glRenderbufferStorage. Sadly, the following code fails to result in a valid FBO. Can someone please tell me what I missed?: glGenFramebuffers(1, &m_framebuffer); glBindFramebuffer(GL_FRAMEBUFFER, m_framebuffer); glGenRenderbuffers(1, &m_colorbuffer); glBindRenderbuffer(GL_RENDERBUFFER, m_colorbuffer); GLsizei width = (GLsizei)layer.bounds.size.width; GLsizei height = (GLsizei)layer.bounds.size.height; glRenderbufferStorage(m_colorbuffer, GL_RGBA8_OES, width, height); glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, m_colorbuffer); Note: The layer size is valid and correct. This is solid production working rendering code. The only change I am making is the line glRenderbufferStorage(...) previously I did: [m_context renderbufferStorage:GL_RENDERBUFFER fromDrawable:layer] Thanks, Doug

    Read the article

  • OpenGL ES 2. How do I Create a Basic Fading Streak Effect?

    - by dugla
    For the iPad app I am writing using OpenGL ES 2 I have a single quad - shaded using GLSL - that is dragged around the screen. Very basic. This works fine. But is rather boring. I want to increase the coolness a bit in the following way: when the user drags the quad it leaves a streak behind that fades over time. Continuous dragging would be a bit like a streaking comet across the night sky. What is the simplest way to implement this? Thanks.

    Read the article

  • UISplitViewController. Can we hide/show the master view?

    - by dugla
    I would like to use a UISplitViewController in a slightly different way then is common. Because my iPad app is fullscreen app I would like the ability to hide/show the master view when in landscape mode. Portrait view is not an issue since the master view transforms into a popover which can be hidden via the toolbar button. Is there a method on UISplitViewController that will nicely hide the master view and expand the detail view? Any insight would be most appreciated. Cheers. Thanks, Doug

    Read the article

  • UIScrollView. Any thoughts on implementing "infinite" scroll/zoom?

    - by dugla
    So, UITableView supports essentially "infinite" scrolling. There' may be a limit but that sucker can scroll for a looonnnggg time. I would like to mimic this behavior with a UIScrollView but there are two fundamental impediments: 1) scrollView.contentSize is fixed at creation time. 2) zooming can blow any lazy-loading scheme all to hell since it can cause infinte data explosion. Have others out there pondered this idea? Yah, I know, we are essentially talking about re-creating Google Maps here. Any insights would be much appreciated. Cheers, Doug

    Read the article

  • UIPopoverController. Is there way to use Interface Builder to layout the VC and View it Contains?

    - by dugla
    Since UIPopoverController is often a container for a non-trivial amount of view hierarchy, it would be nice to do the layout of the VC and View it contains in Interface Builder rather then programmatically. Has anyone found a good work flow for do this? For example I want to embed a UIScrollView in a UIPopoverController and I am not excited about having to do it all programmatically. Thanks in advance. Cheers, Doug

    Read the article

  • iPad. UIBarButtonItem has an undocumented view of type UIToolbarTextButton. Huh?

    - by dugla
    I have an iPad app where I have a view controller that is the UIGestureRecognizerDelegate for a number of UIGestureRecognizers. I have implemented the following method of UIGestureRecognizerDelegate: - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch { // Double tapping anywhere on the screen hides/shows the toolbar if ([gestureRecognizer isKindOfClass:[UITapGestureRecognizer class]] == YES) { if (touch.tapCount == 2) { self.toolbar.hidden = self.toolbar.isHidden ? NO : YES; } // if (touch.tapCount == 2) } // if ([gestureRecognizer isKindOfClass:[UITapGestureRecognizer class]] == YES) // All gestures are ignored unless they happen on the fullscreen EAGLView if ([touch.view isKindOfClass:[EAGLView class]] == NO) { return NO; } // if ([touch.view isKindOfClass:[EAGLView class]] == NO) return YES; } My setup is a fullscreen EAGLView with a UIToolbar atop the EAGLView. There is a UIBarButtonItem on the toolbar. The idea here is that double-tapping anywhere toggles the appearance of the toolbar. All other gestures must occur on the EAGLView. My problem is that taps directly on the UIBarButtonItem show touch.view to be the UIView subclass UIToolbarTextButton which is undocumented and can't be introspected. Huh? Can someone suggest a work around, preferably that uses introspective goodness of some form? Thanks, Doug Thanks, Doug

    Read the article

  • iPad Gestures. How Do I Force a Child View to Discard Gesture Events.

    - by dugla
    On iPad, I have a parent-child view hierarchy. The parent is a fullscreen EAGLView and the child is a UIToobar. The parent has pan/touch/pinch gesture recognizers attached. When gestures occur on the child (toolbar) they are passed on to the parent (fullscreen view). Not what I want. How do I force the toolbar to discard/ignore gestures? Thanks, Doug

    Read the article

  • CoreGraphics on iPhone. What is the proper way to load a PNG file with pre-multiplied alpha?

    - by dugla
    For my iPhone 3D apps I am currently using CoreGraphics to load png files that have pre-multiplied alpha. Here are the essentials: // load a 4-channel rgba png file with pre-multiplied alpha. CGContextRef context = CGBitmapContextCreate(data, width, height, 8, num_channels * width, colorSpace, kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big); // Draw the image into the context CGRect rect = CGRectMake(0, 0, width, height); CGContextDrawImage(context, rect, image); CGContextRelease(context); I then go on and use the data as a texture in OpenGL. My question: By specifying pre-multiplied alpha - kCGImageAlphaPremultipliedLast - am I - inadvertently - telling CoreGraphics to multiply the r g b channels by alpha or - what I have assumed - am I merely indicating that the format of the incoming image has pre-multiplied alpha? Thanks, Doug

    Read the article

  • Why Does the iPad Toolbar Refuse to Reappear When Orientation Changes?

    - by dugla
    I have a fullscreen OpenGL iPad app that behaves correctly for all orientation changes. I now want to add a UIToolbar programmatically and while it appears correctly in launch orientation - portrait in the Xcode simulator - it dissapears when the orientation changes to landscape. Change the orientation back to portrait and the Toolbar reapppears. Huh? - (void)loadView { NSLog(@"EAGL ViewController - load View"); CGRect frame = [[UIScreen mainScreen] applicationFrame]; EAGLView *eaglView = [[[EAGLView alloc] initWithFrame:frame] autorelease]; self.view = eaglView; [[NSBundle mainBundle] loadNibNamed:@"Toolbar" owner:self options:nil]; NSLog(@"%@", [[self.toolbar class] description]); [self.view addSubview:self.toolbar]; [self.view bringSubviewToFront:self.toolbar]; } What have I failed to do here? Thanks, Doug

    Read the article

  • iPad + OpenGL ES2. Why the Puzzling Virtual Memory Spike During Device Reorientation?

    - by dugla
    I've been spending the afternoon starring at Xcode Instruments memory monitor trying to decipher the following memory issue. I have a fullscreen OpenGL ES2 app running on iPad. I am fanatical about memory issues so my retains/releases are all nicely balanced. I closely monitor memory leaks. My app is basically squeeky clean. Except occassionally when I reorient the device. Portrait to Landscape. Back and forth I rock the device stress testing my discarding and rebuilding of the OpenGL framebuffer. The ambient memory footprint of my app is about 70MB Real Mems and 180MB Virtual Mems. Real memory hardly varies at all during device rotations. However the virtual mems reading sometimes briefly spikes up to 250MB and then recedes back to 180MB. No real pattern. But clearly related discarding/rebuilding the framebuffer. I see random memory warnings in my NSlogs but the app just hums along, no worries. 1) Since iPhone OS devices don't have VM could someone explain to me what the VM reading actually means? 2) My app totally leak free and generally bulletproof dispite the VM spikes. Never crashes. Rock solid. Should I be concerned about this? 3) There is clearly something happening in OpenGL framebuffer land that is causing this but I am using the API in the proper way: paraphrasing: Discarding the framebuffer: glDeleteRenderbuffers(1, &m_colorbuffer); glDeleteFramebuffers(1, &m_framebuffer); Rebuilding the framebuffer: glGenFramebuffers(1, &m_framebuffer); glGenRenderbuffers(1, &m_colorbuffer); Is there some other memory flushing trick I have missed? Thanks for any insight. Cheers, Doug

    Read the article

  • UITableView Question. How do I preselect a tableView cell?

    - by dugla
    I assumed that the correct way to preselect a cell in a table view was: - (void)selectRowAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated scrollPosition:(UITableViewScrollPosition)scrollPosition However it does absolutely nothing. Nadda. For context I am building an iPad app and the tableview is deployed from a Popover ViewController. So the tableView is only visible when deployed. I am currently calling the above method in: - (void)viewDidAppear:(BOOL)animated; Any thoughts? Thanks, Doug

    Read the article

  • Git Subtree. Why can't I branch from a subtree rather than the root?

    - by dugla
    I am struggling trying to make sense of using the Git subtree strategy. My intent was to pull some disparate repos together into a little family of toy repos under an umbrella repo. I'm using the subtree strategy detailed here: http://help.github.com/subtree-merge I am pulling my hair out trying to convince Git that I want to create a branch from one of these subtrees NOT from the root. When I cd into a subtree, create the branch, and then cd back to the root, running git branch from the root clearly indicates the branch was created at the root. Sigh. I love git/github but it is maddening getting this seemingly routine task to work properly. Could someone please enlighten me?

    Read the article

  • Why Does the iPad Main View Refuse to go FullScreen?

    - by dugla
    I am doing an imaging app for iPad and it requires use of the entire screen. The approach I have used on iPhone does not appear to work on iPad. In Interface Builder I have set the UIToolbar to translucent.This code echos the dimensions of the main view before and after requesting fullscreen. (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [self.window addSubview:self.viewController.view]; NSLog(@"Hello Popover AD - application did Finish Launching With Options - viewSize: %f %f BEFORE", self.viewController.view.bounds.size.width, self.viewController.view.bounds.size.height); [self.viewController setWantsFullScreenLayout:YES]; [self.viewController.view layoutIfNeeded]; NSLog(@"Hello Popover AD - application did Finish Launching With Options - viewSize: %f %f AFTER", self.viewController.view.bounds.size.width, self.viewController.view.bounds.size.height); [self.window makeKeyAndVisible]; return YES; } This is what NSlog has to say: Hello Popover AD - application did Finish Launching With Options - viewSize: 768 1004 BEFORE Hello Popover AD - application did Finish Launching With Options - viewSize: 768 1004 AFTER Can someone please tell me what I am doing incorrectly here? Note, on iPhone I set fullscreen within the init method of the relevant ViewController. Can view resizing only be done in a ViewController? My ultimate goal is a fullscreen view nicely tucked underneath a translucent status bar and tool bar. I will retract the status/tool bars when user interaction begins in the main view. Thanks, Doug

    Read the article

  • UIPopoverController. Is is appropriate to embed a tableViewController within?

    - by dugla
    I am doing an iPad imaging app and I am considering UIPopoverController as my workhorse user interface element. The user will spend most of their time immersed in fullscreen content (in both portrait and landscape). When the user wants to select a different piece of content I want to use UIPopoverController to handle that. Is it appropriate to embed a tableViewController in a UIPopoverController to allow in-place scrolling or am I abusing the intended use of UIPopoverController? Thanks, Doug

    Read the article

  • iPhone + OpenGL. How Do I Correctly Switch From Landscape to Portrait?

    - by dugla
    Because of the additional complexity of drawing via an EAGLView vs. a UIView I was wondering of someone has found a robust way to handle changing the device orientation from Landscape to Portrait. One approach is to tear down the framebuffer and rebuild from scratch which would require saving/retrieving scene state. The other would be far simpler: just rotate and resize the view. What is the best practice for this? Thanks, Doug

    Read the article

  • iPhone Internationalization. What is the simplest workflow for me?

    - by dugla
    Hello, I am wising up and getting my internationalization act together. Right off the bat I am a bit swamped by all the docs Apple provides so I was wondering of someone could sketch a workflow for my situation. Before I begin, I browsed some Apple example code and noticed this NIB file - MainWindow.xib - in the Resources folder: This clearly has something to do with internationalization/localization. Could someone please explain how this is created and where in the workflow it happens? My app is fundamentally an imaging app with a few labels that I currently programmatically internationalize using NSLocalizedString(...). If I set all my labels programmatically and wrap all my strings with NSLocalizedString(...) can I completely ignore the NIB issues? Thanks in advance, Doug

    Read the article

  • iPhone+Quartz+OpenGL. What is the correct way for Quartz and OpenGL to play nice together regarding

    - by dugla
    So we know the CoreGraphics/Quartz imaging model is based on pre-multiplied alpha. We also know that OpenGL blending is based on un-premultiplied alpha. What is the best practice to avoid head explosion when doing blending with textures that are derived from pre-multiplied alpha imagery (PNG files generated in Photoshop with pre-multiplied alpha). Given the apples/oranges mish mash of Quartz and OpenGL, what is the correct glBlendFunc for doing the fundamental Porter/Duff "over" operation? Typical example: A simple paint program. Brush shapes are texture-map patterns created from pre-multiplied alpha rgba images. Paint color is specified via glColor4(...) with the alpha channel used to control paint transparency. GL_MODULATE is used so the brush texture multiplies the (translucent) paint color to blend the color into the canvas. Problem: The texture is premult. The color is not. What is the correct way to handle this fundamental inconsistency? Thanks, Doug

    Read the article

  • How do I rewrite a plist if its data types are immutable?

    - by dugla
    I am getting comfortable with using plists for initializing my app. I now want to save app state back to the plist used to initialize the app and I find myself stuck. At application startup I ingest the plist into an NSDictionary which is immutable. I now want to update the NSDictionary by replacing old values with new values for existing keys and write to the plist via [NSDictionary writeToFile:atomically]. How do I get around the immutability of NSDictionary? Thanks, Doug

    Read the article

  • Cocoa-Touch Fun. Name the Alphanumerically Longest Method Name?

    - by dugla
    So, as I get comfortable with Cocoa/Cocoa-Touch I, like others can't help but notice the rather verbose method names. What is the absolutely longest method in Cocoa-Touch that you have come across? To kick things off, I submit that perennial favorite from UITableViewController - tableView:accessoryButtonTappedForRowWithIndexPath: Cheers, Doug

    Read the article

1 2  | Next Page >