idTech4.Renderer.idRenderSystem.BeginFrame C# (CSharp) Method

BeginFrame() public method

public BeginFrame ( int windowWidth, int windowHeight ) : void
windowWidth int
windowHeight int
return void
		public void BeginFrame(int windowWidth, int windowHeight)
		{
			if(this.IsRunning == false)
			{
				return;
			}

			_guiModel.Clear();

			// for the larger-than-window tiled rendering screenshots
			if(_tiledViewPort.X > 0)
			{
				windowWidth = (int) _tiledViewPort.X;
				windowHeight = (int) _tiledViewPort.Y;
			}

			idE.GLConfig.VideoWidth = windowWidth;
			idE.GLConfig.VideoHeight = windowHeight;

			_currentRenderCrop = 0;
			_renderCrops[0] = new idRectangle(0, 0, windowWidth, windowHeight);

			// screenFraction is just for quickly testing fill rate limitations
			if(idE.CvarSystem.GetInteger("r_screenFraction") != 100)
			{
				int w = (int) (idE.VirtualScreenWidth * idE.CvarSystem.GetInteger("r_screenFraction") / 100.0f);
				int h = (int) (idE.VirtualScreenHeight * idE.CvarSystem.GetInteger("r_screenFraction") / 100.0f);

				// TODO: CropRenderSize(w, h);
				idConsole.Warning("idRenderSystem.CropRenderSize");
			}

			// this is the ONLY place this is modified
			_frameCount++;

			// just in case we did a common->Error while this
			// was set
			_guiRecursionLevel = 0;

			// the first rendering will be used for commands like
			// screenshot, rather than a possible subsequent remote
			// or mirror render
			//	primaryWorld = NULL;

			// set the time for shader effects in 2D rendering
			_frameShaderTime = idE.EventLoop.Milliseconds * 0.001f;

			//
			// draw buffer stuff
			//
			SetBufferRenderCommand cmd = new SetBufferRenderCommand();
			cmd.FrameCount = _frameCount;

			if(idE.CvarSystem.GetBool("r_frontBuffer") == true)
			{
				cmd.Buffer = Gl.GL_FRONT;
			}
			else
			{
				cmd.Buffer = Gl.GL_BACK;
			}

			_frameData.Commands.Enqueue(cmd);
		}