- Texture tex = new Texture();
- tex.loadFromPixels(null, rect.width, rect.height, this._depth, this._format);
- int[4] vport;
- glGetIntegerv(GL_VIEWPORT, &vport[0]);
- ///
- glPushAttrib(GL_VIEWPORT_BIT);
- glViewport(0, 0, rect.width, rect.height);
- if (!glIsEnabled(GL_TEXTURE_2D)) {
- glEnable(GL_TEXTURE_2D);
- }
- this._render(rect);
- tex.bind();
- glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, rect.width, rect.height);
- glPopAttrib();