Forum > Android

OpenGL ES 2.0



I'm thinking about porting the hello-gl2 demo from the Android NDK to learn a bit about using pixel shaders in OpenGL ES 2.0.

I found the following port of the OpenGL ES 2.0 headers in the bug tracker:

According to the poster it should not be a lot of work to make the necessary adjustments for Android:

--- Quote from: Benjamin Rosseaux ---Someone can make maybe a true patch from this for FreePascal for a offical
android target support in FreePascal. And my OpenGL ES 2.0 headers (what I did originally for Nokia N900 for Maemo 5) are already in the FPC
bugtracker, which should also under Android after a single-line-change of
the OpenGL ES library path.

--- End quote ---

Is there anything in particular that I need to think about when doing this?

Ok, I managed to port it (see attachment.) Now we have a demo that shows how to use OpenGL ES 2.0 together with JNI.

Some notes:

* For some strange reason the compiler would name the library instead of I checked the project options and everything looked fine...
* It doesn't look like unit initialization is invoked and since the gles20 unit links dynamically, we need to manually call LoadGLESv2(). This is done in the first JNI callback, but maybe there is a better strategy?
* There are some types in gles20.pas that are linked to native types (EGLNativePixmapType is an alias for HDC in Windows and an alias for TWindow in linux, which I think is the X11 convention. However, when I used the X11 aliases in Android, the linker complained about not being found, so I've just declared these types as integers. I don't know what would be the best convention here.)

* Otherwise there were just some minor hick-ups with regards to string/pchar conventions for the log instructions.

Great, Meanderix!

I don't use Android myself, but I applaud your porting efforts. Hope somebody can give you some clarification and help improve it.



[0] Message Index

Go to full version