- procedure RenderFBO;
- var x: Integer;
- begin
- glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo);
- glPushAttrib(GL_VIEWPORT_BIT or GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT or GL_TEXTURE_2D);
- glPushMatrix;
- // glClear(GL_COLOR_BUFFER_BIT);
- glViewPort(0, 0, Trunc(SizeX), Trunc(SizeY));
- //Rendering the Lights
- glDisable(GL_TEXTURE_2D);
- glColor3f(0, 0, 0);
- glBegin(GL_QUADS);
- Draw2DRect(SIzeX/2, SizeY/2, Trunc(SizeX), Trunc(SizeY));
- glEnd;
- glColor4f(1, 1, 1, 1);
- glEnable(GL_TEXTURE_2D);
- glDepthFunc(GL_ALWAYS);
- glBindTexture(GL_TEXTURE_2D, LightTex);
- glGenerateMipmapEXT(GL_TEXTURE_2D);
- glBegin(GL_QUADS);
- with Spieler do
- Draw2DQuad(XPos, YPos, PlayerSize * 5, PlayerSize * 5);
- for X := 0 to LightCount do
- begin
- case Lights[x].ATyp of
- 0: glColor4f(0.898, 0.223, 0.898, (100 - Lights[X].Spawning) / 100);
- 1: glColor4f(0.882, 0.588, 0, (100 - Lights[X].Spawning) / 100);
- 2: glColor4f(0.098, 0.462, 0.803, (100 - Lights[X].Spawning) / 100);
- 3: glColor4f(1, 0.5, 0, (100 - Lights[X].Spawning) / 100);
- 4: glColor4f(0, 1, 0.95, (100 - Lights[X].Spawning) / 100);
- 5: glColor4f(0, 1, 0.08, (100 - Lights[X].Spawning) / 100);
- 9: glColor4f(0.03, 1, 0, (Lights[X].Spawning) / 100);
- 10: glColor4f(1, 0.98, 0, 0.5);
- end;
- // glColor4f(1, 1, 1, 0.4 * (100 - Lights[X].Spawning) / 100);
- if Lights[X].ATyp < 9 then
- Draw2DQuad((Lights[X].XPos - Spieler.XPos)/1.5 + Spieler.XPos, (Lights[X].YPos - Spieler.YPos)/1.5 + Spieler.YPos, PlayerSize * 4,
- PlayerSize * 4)
- else
- Draw2DQuad((Lights[X].XPos - Spieler.XPos)/1.5 + Spieler.XPos, (Lights[X].YPos - Spieler.YPos)/1.5 + Spieler.YPos, PlayerSize * 2.5,
- PlayerSize * 2.5)
- end;
- glEnd;
- glColor3f(1,1,1);
- glPopAttrib;
- glPopMatrix;
- glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
- end;