How to create OpenGL rendering context on Android device when developing an application with Delphi XE5?
Basically I don't know where to start. There are no OpenGL examples yet.
What I would expect to exist:
Some kind of event (Panel.OnRender) that would provide an existing context in which I could call OpenGL calls.
Generic TOpenGLSurface control that could be placed in forms designer
A way to create context on main form in runtime.
From my research so far I that TWindowManager.Render
has access to OpenGL calls and uses them to render popup windows.
EDIT: Adding a Timer to a form and calling this procedure fills the screen with green, so that means GL context is already there:
procedure TForm1.Timer1Timer(Sender: TObject);
begin
glClearColor(0, 1, 0, 0);
glClear(GL_DEPTH_BUFFER_BIT or GL_STENCIL_BUFFER_BIT or GL_COLOR_BUFFER_BIT);
eglSwapBuffers(TCustomAndroidContext.SharedDisplay, TCustomAndroidContext.SharedSurface);
end;
The question is - how to properly handle it, cos rendering on Timer in controlled environment is definitely a bad idea.