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:

enter image description here

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 (or glfrustum) 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

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -