discuss-gnustep
[Top][All Lists]
Advanced

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

Re: NSOpenGLView


From: Enrico Sersale
Subject: Re: NSOpenGLView
Date: Wed, 08 Nov 2006 15:34:43 +0200
User-agent: GNUMail (Version 1.2.0)

On 2006-11-08 15:26:35 +0200 Renaud Molla <renaud.molla@wanadoo.fr> wrote:

Enrico:
What do you mean by [[self openGLContext] flushBuffer] does the trick?

I mean that an implementation of -drawRect: like this:

- (void)drawRect:(NSRect)rect
{
  glClearColor(0, 0, 0, 0);
  glClear(GL_COLOR_BUFFER_BIT);
  glColor3f(1.0f, 0.85f, 0.35f);
  glBegin(GL_TRIANGLES);
  glVertex3f(0.0,  0.6, 0.0);
  glVertex3f(-0.2, -0.3, 0.0);
  glVertex3f(0.2, -0.3 ,0.0);
  glEnd();
  glFlush();

  /* add this line */
  [[self openGLContext] flushBuffer];
}

will work without the need of a timer.

Will it solve the problem if i remove these calls?
Or do you mean that these make the drawRect: called repeatedly?
And what does the timer if it is created and scheduled, set to repeat, is never invalidated in the code and calls pulseColor which in turn calls setNeedsDisplay: that will then call drawRect:
?

If anybody still thinks about something, let me know

Renaud

On Nov 8, 2006, at 12:27 PM, Enrico Sersale wrote:

On 2006-11-08 12:41:52 +0200 Renaud Molla <renaud.molla@wanadoo.fr>  wrote:

Hi,
I'm trying to write an NSOpenGLView application (actually i'm using an example from Stefan Urbanek
        http://lists.gnu.org/archive/html/discuss-gnustep/2004-11/ msg00191.html
        and corrected the things so it launches and run),
but the NSOpenGLView doesn't display anything although the drawRect method is called regularly
        through the use of a timer.

It seems that, in the Stefan's example, is the "[[self openGLContext] flushBuffer]" at the end of -drawRect: that does the trick, not the timer.

The view 'contains' what was in the background before the window appeared.
        Moving the window don't make it display anything either.
Making the NSOpenGLView the window contentView does not change anything equally.
        The same code works 100% when compiled with cocoa.
        Any help would be appreciated !-)
Renaud Molla

---------------------------------------------------------------------- ----------------- Orange vous informe que cet e-mail a ete controle par l'anti-virus mail. Aucun virus connu a ce jour par nos services n'a ete detecte.







_______________________________________________
Discuss-gnustep mailing list
Discuss-gnustep@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnustep







reply via email to

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