about converting the content of the uiview to the texture, OpenGL es -


i want convert content of uiview, showing in screen @ present, opengl es textures. but, while this, met trouble. size of textures, processed opengl es, size of input image. while texture rendered screen, size of uiview, showing content of textures, has been changed.

so, if directly read content of uiview, following code, (_drawview belongs class of uiview)

    //convert current uiview texture, opengl es     glubyte *pixelbuffer = (glubyte *)malloc(4 * _drawview.bounds.size.width * _drawview.bounds.size.height);     cgcolorspaceref colourspace = cgcolorspacecreatedevicergb();     cgcontextref context =     cgbitmapcontextcreate(pixelbuffer,                           _drawview.bounds.size.width, _drawview.bounds.size.height,                           8, 4* _drawview.bounds.size.width,                           colourspace,                           kcgimagealphapremultipliedlast | kcgbitmapbyteorder32big);     cgcolorspacerelease(colourspace);     nslog(@"_drawview.bounds.size.width: %f", _drawview.bounds.size.width);     nslog(@"_drawview.bounds.size.height: %f", _drawview.bounds.size.height);      [_drawview.layer renderincontext:context];     glgenbuffers(1, &_masktexture);     glbindtexture(gl_texture_2d, _masktexture);      gltexparameteri(gl_texture_2d, gl_texture_min_filter, gl_linear);     gltexparameteri(gl_texture_2d, gl_texture_mag_filter, gl_linear);      gltexparameteri(gl_texture_2d, gl_texture_wrap_s, gl_clamp_to_edge);     gltexparameteri(gl_texture_2d, gl_texture_wrap_t, gl_clamp_to_edge);      glteximage2d(gl_texture_2d, 0,                  gl_rgba,                  _drawview.bounds.size.width, _drawview.bounds.size.height, 0,                  gl_rgba, gl_unsigned_byte, pixelbuffer);      cgcontextrelease(context);     free(pixelbuffer);      _drawview.hidden = yes; 

then, size of _masktexture not same input image. need data saved in _masktexture computation in shader function, texture of input image. but, not in same size. how solve this?

one problem in code call glgenbuffers, generates object name buffer. use object name glbindtexture call, needs name of texture. need use glgentextures instead valid object name texture.


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -