Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / Mac Programming / March 2007



Tip: Looking for answers? Try searching our database.

Learning Quartz API? Am I on the right track here?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
DevNull - 27 Mar 2007 00:57 GMT
Hello everyone,
I'm in the process of trying to create a tie in for Mac of a library
I've written for Windows and Linux.

The purpose of the API is pretty simple, it just wraps up the platform
specific details of instancing a window, creating an OpenGL context
and processing input.

It works like this, I have a platform generic "Window" object that
inherits from a platform specific "PlatWindow".  In the constructor of
the PlatWindow are all the minutae of instancing a new window,
creating a place for OpenGL to draw, and tying in an input handler etc
and so forth.

Ideally, you should be able to create a new Window with a single line
of code
Window* GLWin = new Window(title,x,y,height,width,fullscreen,
bitdepth);
Once that has been created then you just use normal OpenGL programming
techniques to handle rendering.

Anyways in Linux it was a breeze via GLX, originally in Mac it was
pretty simple using X11-GLX, it windows it was a little more difficult
to get it going but eventually I did using wgl.

Now here's my conundrum,  Yes it does "work" on a Mac using GLX, but
I'ld like to wrap agl instead of glx and at the same time wrap the
native platform widgets, this way the end user does not have to go
through all the trouble of installing glx and friends.

However, as soon as I moved over the code from glx to agl, I started
running into "warning this function is deprecated. (100s of lines of
code evidently)"  Specifically I used code from the OpenGL Super
Bible, chapter 14 to show me what all needed to be where, to pull this
off.  I'll admit the book is old, and reading further it looks like
the code I'm hitting up against is the platform windowing code and
associated widget stuff, i.e. things like SetRect

Looking around I found that SetRect and it's ilk are all part of an
older API called QuickDraw.  And to pour salt in my wounds, the
replacement API called Quartz, is evidently so different that none of
the concepts remain the same.

So I'm asking here, #1 is it worth my time to worry about Quartz,
judging from the number of code samples I'm able to find (roughly 5
none of which deal with OpenGL), it doesn't seem like Quartz is all
that big a deal.  On the other hand, it's a big enough deal that Apple
is willing to state "As of 10.4 this API is deprecated in favor of
Quartz, and QuickDraw will be removed in future releases".

When API docs fail me, I normally turn to books, I went to borders and
couldn't find a single book on Quartz, however I do have a
safari.oreilly.com subscription and was able to find this book,
http://safari.oreilly.com/0321336631
Has anyone read it?  Is it any good?  My major problems with books
occur when they give false and/or inaccurate information, I seem to
bump my head on that a lot, which makes learning a new API very
difficult.  The other problem which is semi-related is that if the
printed code is broken, many times the code on the CD compiles and
runs just fine, but since this is safari I of course would not have a
CD to look at.

Anyways, are there any really good, really accurate books for Quartz,
and is this one of them?

Ok well I've taken plenty of your time, thanks for taking the time to
read this, if anyone could give me direction on where to start on this
path I'ld greatly appreciate it.

As a side note, I always appreciate it when library developers take
the time to use the native platform widgets, and now it's my turn to
be a library developer, I'ld like to extend the same courtesy to the
users of my library.
Patrick Machielse - 27 Mar 2007 10:10 GMT
> It works like this, I have a platform generic "Window" object that
> inherits from a platform specific "PlatWindow".  In the constructor of
[quoted text clipped - 8 lines]
> Once that has been created then you just use normal OpenGL programming
> techniques to handle rendering.

It sounds like you could use / wrap around standard Cocoa widgets,
specifically an NSWindow containing an NSOpenGLView

<http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit
/Classes/NSOpenGLView_Class/Reference/Reference.html>

> So I'm asking here, #1 is it worth my time to worry about Quartz,
> judging from the number of code samples I'm able to find (roughly 5
> none of which deal with OpenGL), it doesn't seem like Quartz is all
> that big a deal.  On the other hand, it's a big enough deal that Apple
> is willing to state "As of 10.4 this API is deprecated in favor of
> Quartz, and QuickDraw will be removed in future releases".

Take that warning seriously: QuickDraw is very dated, and very dead. It
was a major (MAJOR!) feat in 1984, enabling the Mac gui in the first
place, but it has since been eclipsed. Quartz has replaced it.

> When API docs fail me, I normally turn to books, I went to borders and
> couldn't find a single book on Quartz, however I do have a
> safari.oreilly.com subscription and was able to find this book,
> http://safari.oreilly.com/0321336631
> Has anyone read it?  Is it any good?

I don't own any books on Quartz. Another book, which is said to be very
good is this one:

<http://www.amazon.com/Programming-Quartz-Graphics-Kaufmann-Computer/dp/
0123694736>

patrick
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.