"boingX" (transparent ogl) under carbon

Post: #1
Hi to all, and sorry my english, this is my first post!

my question is: I saw the boingX sample and I'm interested in putting
the same effect in a carbon (XCode1.2) app.

First of all I found the SetWindowAlpha() statement to change the windows behaviour in a trasparent one, then AGL_SURFACE_OPACITY enable the same as NB.....SurfaceOpacity cocoa instruction, now I dont understand how to make a SOLID object in the middle of the desktop ... the object change his transparency value accordly to the AGL_SURFACE_OPACITY so it is semitransparent too.

tnx in advance
Quote this message in a reply
Posts: 20
Joined: 2002.12
Post: #2
Never having seen the boingX sample, I'm not quite sure what you're asking. If you want a transparent window (no frame, widgets, or background) and an opaque OpenGL context, what you want to do is create an overlay window.

First, create the window using CreateNewWindow
SetRect(&Bounds, 50, 50, 350, 350);
    kWindowNoAttributes, &Bounds, &Window);
Notice the window class is "kOverlayWindowClass" and the attributes parameter is "kWindowNoAttributes".

Create the AGL ContextÖ
Format = aglChoosePixelFormat(NULL, 0, Attrib);
Context = aglCreateContext(Format, NULL);
aglSetDrawable(Context, GetWindowPort(Window));

Now, we need to set the context opacity so that it can have a transparent background.
GLint Opacity = 0;
aglSetInteger(Context, AGL_SURFACE_OPACITY, &Opacity);
glClearColor(0, 0, 0, 0);

That's it. Draw into the context like you would normally. Instead of filling the context with a color, glClear(GL_COLOR_BUFFER_BIT) will "erase" what you've drawn, making the window completely transparent.

"Programmers are tools for converting caffeine into code."
Quote this message in a reply
Post: #3
1024K thanks Akisha!!

Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Transparent textures kordeul 2 3,786 Aug 27, 2007 01:38 AM
Last Post: kordeul
  OpenGL, SDL, and Transparent Bitmaps RyanA 4 5,770 Jun 26, 2006 04:26 PM
Last Post: RyanA
  About transparent colors un textures valle 2 3,605 Oct 26, 2004 09:52 AM
Last Post: valle
  Blending mode for Transparent fog? JeroMiya 2 3,420 Jan 30, 2004 08:09 AM
Last Post: MattDiamond
  Panther + BoingX MacFiend 4 3,889 Jan 10, 2004 08:12 AM
Last Post: MacFiend