- // Initialisieren von unserer Anwendung
- procedure glInit;
- begin
- // Alle OpenGL States auf standard setzten
- OGLStates.Clear;
- end;
- // Unsere Procedure zum Rendern
- procedure DrawLight;
- begin
- // Pass 1 (PerPixelLighting)
- OGLStates.Enable(GL_BLEND);
- OGLStates.BlendOperation(GL_ONE, GL_ONE);
- OGLStates.Enable(GL_TEXTURE_3D);
- OGLStates.TexGen(True);
- OGLStates.BindTexture(GL_TEXTURE_3D, TexLightIntensity);
- DrawPolys(PERPIXELLIGHT); // Polygone rendern
- OGLStates.Reset; // Alles wieder auf standard setzten.
- // Pass 2 (Normale Texture)
- OGLStates.Enable(GL_BLEND);
- OGLStates.BlendOperation(GL_DST_COLOR, GL_ZERO);
- OGLStates.Enable(GL_TEXTURE_2D);
- OGLStates.BindTexture(GL_TEXTURE_2D, BaseTexture);
- DrawPolys(BASE); // Polygone rendern
- OGLStates.Reset; // Alles wieder auf standard setzten.
- // Pass 3
- DrawLights; // Sphere oder Blend/Texturen rendern
- end;