0

After I overlay an application over my previous application, I go back to previous application and encounter a few errors:

  • certain components have disappeared
  • only way to make the components visible is to resize the window
  • that seems to redraw the whole canvas.

  1. Weird thing is that there are only a couple of components and drawn images that are missing
  2. It doesn't always happen but only a couple of times
  3. I haven't found a solid way to reproduce the problem.

Anybody have an Idea why this is happening?

SkylerHill-Sky
  • 2,106
  • 2
  • 17
  • 33
Andy Jacobs
  • 15,187
  • 13
  • 60
  • 91
  • How are these components/images drawn? If you want to progress this with Apple you'll need a sample app that shows the problem; can you provide one? (it'll be useful anyway - I currently have a CALayer artifact issue which I cannot reproduce in the sample app!) – trojanfoe Sep 28 '12 at 15:24
  • 1
    is it possible to simulate a resize by code? – Andy Jacobs Oct 01 '12 at 12:27
  • You can just call `[self setFrameSize:size]` I would imagine. – trojanfoe Oct 02 '12 at 08:05
  • 1
    Do you have any custom drawing in the app? Does the app appear sluggish when the prob happens prob signifying a memory issue? – Just a coder Oct 03 '12 at 01:52

1 Answers1

0

I experienced exactly the same issue (view was updated correctly only after resizing), except that I've used OpenGL drawing in OSX game.

My problem was solved by adding this:

GLint vblSynch = 1;
[[self openGLContext] setValues:&vblSynch forParameter:NSOpenGLCPSwapInterval];

in my custom NSOpenGLView init method. Then I've implemented:

- (void)drawRect:(NSRect)rect
{
    [self destroyFramebuffer]; // glDeleteFramebuffers..
    [self createFramebuffer];  // [super prepareOpenGl], glGenFrame(Render)Buffers, bind buffers, etc
    [self drawView]; // [[self openGLContext] makeCurrentContext], make some drawing, [[self openGLContext] flushBuffer]..
}

like this.

After these changes, when window gets focus it redraws itself (without any resizing stuff :) ).

Hope this helps!

Dmitry Zhukov
  • 1,809
  • 2
  • 27
  • 35