ios - Opengl View drawing issue -
for dimension consideration, resize opengl view 2.0 scale origin, this:
nsinteger dimension = 2; self.glview = [[wqpaintglview alloc] initwithframe:cgrectmake(0, 0, width*dimension, height*dimension)]; cgaffinetransform tscale = cgaffinetransformmakescale((float)1/dimension, (float)1/dimension); cgaffinetransform ttranslate = cgaffinetransformtranslate(tscale, -width, -height); self.glview.transform = ttranslate; [self.canvascontainerview addsubview:self.glview];
but strange issue, see:
i can draw stuff in left bottom 1/4 area.
what did wrong?
the uiview
transform , opengl not compatible. view resizing after opengl initialization troublesome , in cases new render buffer must created view.
anyway since scaled view have larger surface should check following calls:
glviewport
should define part of buffer writing at. set (0, 0, viewwidth, viewheight). in case must include scale well.glortho
(orglfrustum
) define coordinate system if used. should same no matter view scale.- any other matrix usage or scissors may defined view's frame.
by means if possible remove transform on view , try find better solution.
Comments
Post a Comment