Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CoreImage drawImage messing with my clean lines



I posted this on the Quartz-Dev list a bit ago, but after a bit of investigation I'm getting stuck trying to figure this out, and the area that I'm getting stuck in is OpenGL.

On May 27, 2007, at 1:34 PM, Jonathan Johnson wrote:

Sorry for the strange title -- couldn't come up with a smaller summary that still made sense :) I have a NSOpenGLView which I aquire its CGLContextObj/CGLPixelFormatObj to create a CIContext. I then draw an image using drawImage:inRect:fromRect:. This all works great, and my code to ensure pixel alignment works for this call.

However, I then attempt to draw some geometry in OpenGL, mainly noticed with GL_LINE_STRIP. If I don't call drawImage, these lines are crisp and pixel-aligned. However, after calling drawImage they are no longer crisp -- they've undergone subpixel rendering.

I've tried to do a few things, but am out of ideas. I'm not an advanced OpenGL developer, so I'm sure I'm just missing some setting. I've tried glLoadIdentity() thinking it was an issue with the matrix, I've tried re-setting up the view to its old state as well. I'm also explicitly setting the line width to 1.0.

So I'm curious what else CIContext drawImage could be messing with in my OpenGL context. Any ideas would be greatly appreciated.

I investigated this a bit more with OpenGL Profiler. I put a breakpoint on glLineWidth which is after my drawImage call, and ran my program twice under the profiler -- once with the drawImage call enabled, and once with it commented out.


Using the state tab, I was able to find the only differences in state between these two cases. Current Vertex->GL_TEXTURE0- >GL_CURRENT_TEXTURE_COORDS is {52, 356, 0, 1} instead of {0, 0, 0, 1}, and secondly Textures->GL_TEXTURE0- >GL_TEXTURE_BINDING_RECTANGLE_EXT is 2 instead of 0.

The things I was expecting to cause this behavior haven't changed -- the projection, transpose, and modelview matrixes. They are identical with or without the drawImage call. So, the textures are the only known differences I can see. What's odd though is that GL_TEXTURE_1D, 2D, etc. are all disabled, which would make me believe that these settings wouldn't affect my line drawing.

Does anyone have any ideas on how these differences might be affecting my line drawing, or any ideas on where else to look to see what might be going on?

Thanks in advance,
Jon
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Mac-opengl mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/mac-opengl/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.