Mailing List
Home
Forum Home
MUD Dev - Discussion of MUD system design, development, and implementation
Mac Game - Mac game development
Rivers of MUD - a Diku and Merc based multiuser dungeon
SMAUG
Subjects
Getting UDP through NAT/firewalls/whatever for a game
Getting UDP through NAT/firewalls/whatever for a game
QuickTime errors
Python script as stand alone MUD server
Various sound problems
Fragment Shaders & GL TEXTURE RECTANGLE EXT
Timers and global variables
Re: Language and platform for Text MUD server
Apparent acquisition of Yantis (mysupersales) by IDE
HID keyboard
Getting UDP through NAT/firewalls/whatever for a game
Microsoft Sparkle
Director MX
Congratulations Horizons
Yet more problems fullscreen mode
Apple Dev Kitchen Them 's tasty vittles, Maw!
NSOpenGLContext, Pbuffers, and drawables
More DCR "theft " naughtiness
dynamic sprite creation and imaging lingo
Re: Find stuff in Flash array?
Effects of skill imbalances?
QuickTime errors
Rom 2 4/Quickmud Enhancement/Bug fix
Working with XML files/CFURL
smooth scrolling/subpixel tweening
RE: (Ron help me?) Flash text
Flash Racing
MudDev FAQ 2
Browser based games
Installing GLUT
Special character in Flash XML
 
Search:  
Power your search with and, or, +, -, or "some phrase" operators.
NSOpenGLContext, Pbuffers, and drawables...

NSOpenGLContext, Pbuffers, and drawables...

2004-01-25       - By Brad Anderson

 Back
hello all!

With the significant amount of knowledge here on the list, we should be
able to figure out why the pbuffer is causing a horizontal line in the
middle of my screen.  The problem happens when calling
    [[self openGLContext] clearDrawable];
This is a necessary call apparently because opengl does not update the
context correctly without it before setting the saved view.  BUT
calling this function causes the white block.  if I take it out, the
screen is white (aka, the drawable is not set up correctly).  Lastly,
if I get the CGLContextObj from the NSOpenGLContext, and call the
appropriate CGL call to clear the drawable, once again, the screen is
white.  How does one go about doing an NSopenGLView that is full
screen, with pbuffers?

It seems to me that NSOpenGLContext has not been updated with pbuffer
calls.

The summary question:  How does one go about doing pbuffers in
NSOpenGLView/NSOpenGLContext without having the white flash?

  my conclusion is to just run the whole thing in CGL...  at the cost of
re-inventing the "wheel."
Brad


the draw code:

pbuffer initialization code
.....
    if (CGLCreatePBuffer (256, 256, GL_TEXTURE_2D, GL_RGBA, 0,
&(pBuffer.aglPbuffer)))
     aglReportError ();
.....



//Self is a subclass of NSOpenGLView
- (void) drawRect:(NSRect)rect
{
    int err;
    float y;
    [[self openGLContext] makeCurrentContext];
    if (NO == fGLInit) {
  [self prepareOpenGL];
    }
    NSView *savedView = [[self openGLContext] view];
    [[self openGLContext] makeCurrentContext];
    GLint vs = [[self openGLContext] currentVirtualScreen];

    if(CGLSetPBuffer([[self openGLContext] CGLContextObj],
pBuffer.aglPbuffer, 0, 0, vs)) {
  printf ("error in pbuffer");
    }
    [script RenderMovement];

//*******************  THE CODE CAUSING PROBLEMS
    [[self openGLContext] flushBuffer];
    [[self openGLContext] clearDrawable];
  //Clearing causes the white flash in the middle
  //putting a delay here causes the white flash to become a white screen
  //BUT without it, the saved view is not set.  the problems with
pbuffer are documented BY Apple.
  //This might be a first with cocoa and pbuffers
    [[self openGLContext] setView:savedView];
//*******************  END OF PROBLEM CODE

    if(pBuffer.texName == 0) {
  glActiveTextureARB(GL_TEXTURE2_ARB);
  glEnable(GL_TEXTURE_2D);
  glGenTextures (1, &pBuffer.texName);
  glBindTexture (GL_TEXTURE_2D, pBuffer.texName);
  glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
  CGLTexImagePBuffer ([[self openGLContext] CGLContextObj],
pBuffer.aglPbuffer, GL_FRONT);
    }
 
    // setup viewport and prespective
    [self resizeGL]; // forces projection matrix update (does test for
size changes)
    [self updateModelView];  // update model view matrix for object
 
    [script updateState:tDeltaTime];
    [script draw:pBuffer.texName];
 
    if ([self inLiveResize] && !fAnimate)
     glFlush ();
    else
     [[self openGLContext] flushBuffer];
    err = glReportError ();
}
__ ____ ____ ____ ____ ____ ____ ____ ____ ____
mac-games-dev mailing list | mac-games-dev@(protected)
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/mac
-games-dev
Do not post admin requests to the list. They will be ignored.



Earn $52 per hosting referral at Lunarpages.