Hi,
Got this working ... just needed to read the red book and understand
all the gl calls - the GL_TEXTURE_RECTANGLE_ARB - and all. I'll post
the plug-in and src when I'm done.
My new problem is: the quartz / core graphics drawing is all in
pixels, but the qc world is in normalized units.
I've created an orthographic view to allow pixel coords
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrtho(0, 0 + texturewidth, 0, 0 + textureheight, -1, 1);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
I wonder how then (for example) the resulting plug-in works in a
'trackball'. Currently it doesn't! I think the answer is buried in
GLImage which sets the ortho mode, draws a quad to an FBO and then
uses that as a texture... could I just reset the mode and get 3D
action back?
Sorry to be learning out loud. Just in-case there is any general
advice / pointers on pixels, normalised units, quartz drawing and gl
textures...
Regards, Ian
*******************************
Ian Grant
Senior Lecturer in Digital Art
Faculty of the Arts
Thames Valley University
Ealing, UK
W5 5DX
<[EMAIL PROTECTED]>
*******************************
On 26 Aug 2008, at 16:27, Ian Grant wrote:
Hi,
<round_rect.png>
I have a plug-in (processor) plugin that does some quartz drawing
and outputs it to an image port. This works fine.
I wish (as an exercise) to turn that plug-in into a consumer and
render the quartz drawing to a texture on a quad.
For the processor plugin:
I have a CGContextRef, create a CGBitmapContext - draw in it. Then I
create a provider (using
outputImageProviderFromBufferWithPixelFormat) that is assigned to
self.outputImage.
The consumer plugin code examples all create a texture and bind it
using an inputImage source:
What is the easiest / correct way to create a texture from either my
quartz drawing or from the provider?
I'm aware that passing data around and converting between image
types may be unnecessary and expensive for performance.
e.g.
Searching revealed this:
// Source:
http://developer.apple.com/documentation/GraphicsImaging/Conceptual/OpenGL-MacProgGuide/OpenGLProg_MacOSX.pdf
// gl_Texture from a quartz image source
glPixelStorei(GL_UNPACK_ROW_LENGTH, overallWidth);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glGenTextures(1, &textureName);
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, textureName);
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB,GL_TEXTURE_MIN_FILTER,
GL_LINEAR);
glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA8, overallWidth,
overallHeight, 0, GL_BGRA_EXT, GL_UNSIGNED_INT_8_8_8_8_REV,
imageData);
How does this work in a quartz composer context?
Doesn't bindTextureRepresentationToCGLContext do most of this work?
I guess I will need to match the pixel format?
And a related question:
How do I create an image usable by quartz drawing routines (for an
image mask or fill for example) from an QCPlugInInputImageSource?
Any help would be gratefully received! The source code (up to this
point) is here:
link: <http://ellington.tvu.ac.uk/downloads/QCRoundRectx.zip>
Regards, Ian
*******************************
Ian Grant
Senior Lecturer in Digital Art
Faculty of the Arts
Thames Valley University
Ealing, UK
W5 5DX
<[EMAIL PROTECTED]>
*******************************
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list ([email protected]
)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/ian.grant%40mac.com
This email sent to [EMAIL PROTECTED]
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com
This email sent to [EMAIL PROTECTED]