- procedure TFormMain.FormCreate(Sender: TObject);
- ...
- begin
- InitOpenGL; // Don't forget, or first gl-Call will result in an access violation!
- dc := GetDC(Handle);
- hrc := CreateRenderingContext(dc, [opDoubleBuffered], 32, 24, 0, 0, 0, 0);
- ActivateRenderingContext(dc, hrc); // Necessary, will also read some extension
- glEnable(GL_TEXTURE_2D);
- glEnable(GL_PRIMITIVE_RESTART);
- glPrimitiveRestartIndex(VERTEX_RESTART_INDEX);
- glEnableClientState(GL_NORMAL_ARRAY);
- glEnableClientState(GL_VERTEX_ARRAY);
- glEnable(GL_DEPTH_TEST);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);