Forum > Android

creating openGL context in a unit whithout modifying the main program source

(1/3) > >>

Key-Real:
I wanna open an openGL context in a separate unit and leave my main program source like this:

uses myUnit;
begin
 openGLcontext;
 repeat
  draw;
 until keypress;
 closeGLcontext;
end.


the whole jni stuff with the mainactivity called from java should be in the myUnit.

is this possible?

Seenkao:
Onur Cinar "Pro Android C++ with the NDK"
Retabouil "Android NDK"

TRon:

--- Quote from: Seenkao on January 23, 2023, 12:47:49 am ---Onur Cinar "Pro Android C++ with the NDK"
Retabouil "Android NDK"

--- End quote ---
Which in practice would boil down to: https://www.learnopengles.com/calling-opengl-from-android-using-the-ndk/ (same as my other link in the other thread but with a sexy layout  :) )

Key-Real:
I found this:

https://github.com/android/ndk-samples/tree/main/native-activity

this is exactly what I'm trying to do in pascal.

they have a magic entry point:
 void android_main(struct android_app* state)

Is it possible to convert this entry point to freepascal?

TRon:
@Key_Real:
If not mistaken then: https://github.com/android/ndk-samples/blob/main/native-activity/app/src/main/cpp/CMakeLists.txt

tells that there is some glue.... I have a suspicion that this "glue" is jsut some wrapper function(s) inside a library (but you really would have to take a look at it yourself).

In principle: if it can be done in any other language it can be done with Pascal/FPC.

edit: 2 searches later: https://developer.android.com/ndk/samples/sample_na

Navigation

[0] Message Index

[#] Next page

Go to full version