private void UpdateFrameBuffer() { int texWidth = Width + 1; int texHeight = Height + titleRectangle.Height + 1; if(Extentions.IsAvailable(Extentions.ArbTextureNonPowerOfTwo) == false) { texWidth = (int)Math.Pow(2, Math.Ceiling(Math.Log(texWidth, 2))); texHeight = (int)Math.Pow(2, Math.Ceiling(Math.Log(texHeight, 2))); } int maxTextureSize; GL.GetInteger(GetPName.MaxTextureSize, out maxTextureSize); if (texWidth > maxTextureSize) texWidth = maxTextureSize; if (texHeight > maxTextureSize) texHeight = maxTextureSize; bool requiresSquareTexture = false; //TODO Find the proper cap to test. if (requiresSquareTexture) { texWidth = texHeight = Math.Max(texWidth, texHeight); } if (frameBuffer == null || frameBuffer.width != texWidth || frameBuffer.height != texHeight) { SafeDispose<FrameBuffer>(ref frameBuffer); frameBuffer = new FrameBuffer(texWidth, texHeight); modelViewProjection = Matrix4Helper.CreateOrthographicProjection(0, texWidth, 0, texHeight, 0, 1); } int top = titleRectangle.Y; int left = titleRectangle.X; int right = titleRectangle.X + texWidth - 1; int bottom = titleRectangle.Y + texHeight - 1; frameBufferQuad[0] = new PositionTexture(left, top, 0, 0, 1); frameBufferQuad[1] = new PositionTexture(left, bottom, 0, 0, 0); frameBufferQuad[2] = new PositionTexture(right, top, 0, 1, 1); frameBufferQuad[3] = new PositionTexture(right, bottom, 0, 1, 0); }