Re: advice on a specific task

I was wondering if there was some way to leverage any on-card
calculations only because the GPU is said to be loads faster than the
CPU.

Nice that you spotted the gotcha here, yes; how indeed would I then
compose a series of pixels into line segments. I'm aware that I can
load vertex info onto the card, and I was wondering if this stuff
could be assembled on card and then read off the card in some way.

I also agree that reading the pixels off is a total waste of time,
both mine and the CPU's...

--
John

On 30/04/2008, at 8:53 PM, John Stiles wrote:

It might be a good learning exercise for OpenGL, but unless you are
dealing with thousands of visible windows, you would be much better
off performance-wise just doing the math on the CPU. Rectangle
intersection calculations should be easy and fast.

I don't see anything here that could leverage GLSL; you're just
drawing filled quads and lines. Your shaders wouldn't have any work
to do.

Also, once you have your result in a texture, it will nicely reflect
the layout of windows on screen, but how do you answer the question,
"where are the edges?" By reading back the texture and scanning the
whole thing, pixel by pixel? That's not very efficient; actually,
more to the point, it's very inefficient.

John Clayton wrote:

Hi All,

I am after tips and suggestions as to how I can detect the visible
edges of all of the windows presently on the desktop. I will use
this information to subsequently add 'snap to visible window edge'
functionality to an existing product.

This might be la-la-land, but bear with me.

After thinking of the following, I was at once disgusted that I
even imagined such a thing and intrigued. So here goes... opening
my thoughts to the world.

Presently, I use a CGWindowListCopyWindowInfo to get a list of all
the windows I'm interested in, and thus I know all the rect areas
that make up all windows, and I know their Z-order as well (the
function returns them in front to back order in the CFArrayRef that
I get given back).

Then a thought struck me on the way home tonight:

I wondered if I could do this all on the graphics card. Wouldn't
it be possible to make this calculation exceptionally quick by
doing the folllowing:
- fill a context that is the size of all screens with white (or do
this per screen, doesnt matter)
- use a unique colour (not white) draw a frame only representing
each window on screen
- use white to fill in each window area completely

then any pixel that wasn't white would represent a visible pixel
that lies on a line segment, and line segments are unique by colour.

Now, the above email might already tell you that:
a) I'm no open-gl developer
b) I have no idea as to the extent of the capabilities of GSL

But I'd be very very keen on hearing your pointers as to whether
this is even a performant idea. The sole reason to go this route
is the belief that working out the visible edges in this way would
be much faster than doing it any other way. Um... also cos it'd be
a fantastic excuse to learn more about open-gl and perhaps even GSL.

Thanks
--
John Clayton
Skype: johncclayton

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Mac-opengl mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Mac-opengl mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden

Apple Footer

This site contains user submitted content, comments and opinions and is for informational purposes only. Apple may provide or recommend responses as a possible solution based on the information provided; every potential issue may involve several factors not detailed in the conversations captured in an electronic forum and Apple can therefore provide no guarantee as to the efficacy of any proposed solutions on the community forums. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.
Apple