Minetest with OpenGL ES
Posted: Wed Sep 16, 2015 3:28 am
Since Minetest ( http://www.minetest.net/ ) works quite badly in raspberry pi (1 and 2) because it is using OpenGL instead of OpenGL ES I am trying to get Minetest running with OpenGL ES 2 in my raspberry pi2.
In order to do this, i installed these packages in the system:
I compiled Irrlicht ogl es 1.9.0 ( at http://svn.code.sf.net/p/irrlicht/code/branches/ogl-es/ ) with the following configuration at /home/pi/irrlicht/ogl-es/include/IrrCompileConfig.h:
executing:
later on I compile minetest as:
And linking fails since at minetest/src/CMakeFiles/minetest.dir/link.txt is missing some libs/include path, so I add:
flags for /home/pi/irrlicht/ogl-es/lib/Linux/libIrrlicht.a linking and then it generates the minetest binary.
finally, in order to select ogles2 I modify minetest.conf by adding:
CEGLManager.cpp , CIrrDeviceLinux.cpp, COGLES2ExtensionHandler.cpp and COGLES2Driver.cpp are missing some code for the chosen combination:
I made some modifications to these classes (The files are attached in the zip file and code is quite dirty since I have not yet get it working) following this: https://github.com/kika123/x11eglrpi/bl ... playCopy.c and this: viewtopic.php?f=63&t=6488
It seems that with these changes OpenGL ES 2Driver is initialized, or at least, I get this log:
But at minetest side the program crashes at font textures creation.
While debugging this error I realized that COGLES2ExtensionHandler::initExtensions was not doing very well, since:
was setting MaxTextureSize to zero, and this was messing with the textures creation.
So, I added more debug and find out that glGetFloatv, glGetIntegerv and glGetString function calls at initExtensions were failing
Here I got stuck. I went to Irrlicht dev channel at freenode's irc and I didn't got much help because some of the Irrlicht core developers are not active anymore... So, it looks like getting Minetest to work with Irrlicht (OpenGL ES) in Raspberry pi would require some help from this community.
Minetest Android client (with Irrlicht ogl es 1.9.0) works perfectly, and so it should work for raspberry pi
Is anybody up to take the challenge? If not... any tips on how I can continue getting Irrlicht (OpenGL ES) to work with Raspberry pi ?
In order to do this, i installed these packages in the system:
Code: Select all
libegl1-mesa-dev - free implementation of the EGL API -- development files
libgegl-dev - Generic Graphics Library (development files)
libgles2-mesa-dev - free implementation of the OpenGL|ES 2.x API -- development files
libgl1-mesa-swx11-dev - free implementation of the OpenGL API -- development files
Code: Select all
#define _IRR_COMPILE_WITH_OPENGL_
#define _IRR_COMPILE_WITH_OGLES1_
#define _IRR_COMPILE_WITH_OGLES2_
#define _IRR_COMPILE_WITH_EGL_MANAGER_
#define _IRR_COMPILE_WITH_GLX_MANAGER_
#define _IRR_COMPILE_WITH_X11_DEVICE_
Code: Select all
make -j 4
Code: Select all
cmake . -DRUN_IN_PLACE=TRUE -DENABLE_GLES=1 -DEGL_INCLUDE_DIR=/opt/vc/include/EGL -DEGL_LIBRARY=/usr/lib/arm-linux-gnueabihf/libEGL.so -DOPENGLES2_INCLUDE_DIR=/opt/vc/include/GLES2 -DOPENGLES2_LIBRARY=/usr/lib/arm-linux-gnueabihf/libGLESv2.so -DFREETYPE_INCLUDE_DIR_freetype2=/usr/include/freetype2 -DFREETYPE_INCLUDE_DIR_ft2build=/usr/include/freetype2 -DFREETYPE_LIBRARY=/usr/lib/arm-linux-gnueabihf/libfreetype.a -DIRRLICHT_SOURCE_DIR=/irrlicht/ogl-es/source/Irrlicht
make -j 4
Code: Select all
-lEGL -lGLESv2 -L/opt/vc/lib
finally, in order to select ogles2 I modify minetest.conf by adding:
Code: Select all
video_driver = ogles2
Code: Select all
#define _IRR_COMPILE_WITH_OGLES2_
#define _IRR_COMPILE_WITH_EGL_MANAGER_
#define _IRR_COMPILE_WITH_GLX_MANAGER_
#define _IRR_COMPILE_WITH_X11_DEVICE_
It seems that with these changes OpenGL ES 2Driver is initialized, or at least, I get this log:
Code: Select all
INFO[Main]: Irrlicht: Creating X window...
INFO[Main]: Irrlicht: Using plain X visual
VERBOSE[Main]: Irrlicht: Visual chosen: : 33
VERBOSE[Main]: Irrlicht: Window Location: 1,30
Window Dimensions 800 x 585
Bit depth : 16
INFO[Main]: Irrlicht: EGL version: 1.400000
VERBOSE[Main]: Irrlicht: CirrDeviceLinux.cpp EDT_OGLES2 - context initialized.
VERBOSE[Main]: Irrlicht: config chosen
VERBOSE[Main]: Irrlicht: surface created
ERROR[Main]: Irrlicht: Creating EGL context for OpenGLESVersion: : 2
ERROR[Main]: Irrlicht: ContextAttrib[1]: : 2
VERBOSE[Main]: Irrlicht: EGL context created with OpenGLESVersion: : 2
ERROR[Main]: Irrlicht: Activating Context EGL
ERROR[Main]: Irrlicht: Activated Context EGL
INFO[Main]: Irrlicht: Using renderer:
INFO[Main]: Irrlicht:
INFO[Main]: Irrlicht:
ERROR[Main]: Irrlicht: COGLES2Driver - genericDriverInit Done
VERBOSE[Main]: Irrlicht: CirrDeviceLinux.cpp EDT_OGLES2 - Created OGLES2 Driver.
VERBOSE[Main]: Irrlicht: CirrDeviceLinux.cpp - Created Driver.
VERBOSE[Main]: Irrlicht: CirrDeviceLinux.cpp - Created Driver OK.
VERBOSE[Main]: Irrlicht: CirrDeviceLinux.cpp - createInputContext.
VERBOSE[Main]: Irrlicht: CirrDeviceLinux.cpp - createGUIAndScene.
While debugging this error I realized that COGLES2ExtensionHandler::initExtensions was not doing very well, since:
Code: Select all
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &val);
MaxTextureSize=static_cast<u32>(val);
So, I added more debug and find out that glGetFloatv, glGetIntegerv and glGetString function calls at initExtensions were failing
Code: Select all
Irrlicht: COGLES2ExtensionHandler::initExtensions:
INFO[Main]: Irrlicht: GL_AMD_compressed_3DC_texture: false
....
....
INFO[Main]: Irrlicht: GL_OES_blend_equation_separate: false
INFO[Main]: Irrlicht: GL_OES_blend_func_separate: false
INFO[Main]: Irrlicht: GL_OES_blend_subtract: false
INFO[Main]: Irrlicht: GL_OES_byte_coordinates: false
INFO[Main]: Irrlicht: GL_OES_compressed_ETC1_RGB8_texture: false
INFO[Main]: Irrlicht: GL_OES_compressed_paletted_texture: false
INFO[Main]: Irrlicht: GL_OES_depth24: false
INFO[Main]: Irrlicht: GL_OES_depth32: false
INFO[Main]: Irrlicht: GL_OES_depth_texture: false
INFO[Main]: Irrlicht: GL_OES_draw_texture: false
INFO[Main]: Irrlicht: GL_OES_EGL_image: false
INFO[Main]: Irrlicht: GL_OES_EGL_image_external: false
INFO[Main]: Irrlicht: GL_OES_EGL_sync: false
INFO[Main]: Irrlicht: GL_OES_element_index_uint: false
INFO[Main]: Irrlicht: GL_OES_extended_matrix_palette: false
INFO[Main]: Irrlicht: GL_OES_fbo_render_mipmap: false
INFO[Main]: Irrlicht: GL_OES_fixed_point: false
INFO[Main]: Irrlicht: GL_OES_fragment_precision_high: false
INFO[Main]: Irrlicht: GL_OES_framebuffer_object: false
INFO[Main]: Irrlicht: GL_OES_get_program_binary: false
INFO[Main]: Irrlicht: GL_OES_mapbuffer: false
INFO[Main]: Irrlicht: GL_OES_matrix_get: false
INFO[Main]: Irrlicht: GL_OES_matrix_palette: false
INFO[Main]: Irrlicht: GL_OES_packed_depth_stencil: false
INFO[Main]: Irrlicht: GL_OES_point_size_array: false
INFO[Main]: Irrlicht: GL_OES_point_sprite: false
INFO[Main]: Irrlicht: GL_OES_query_matrix: false
INFO[Main]: Irrlicht: GL_OES_read_format: false
INFO[Main]: Irrlicht: GL_OES_required_internalformat: false
INFO[Main]: Irrlicht: GL_OES_rgb8_rgba8: false
INFO[Main]: Irrlicht: GL_OES_single_precision: false
INFO[Main]: Irrlicht: GL_OES_standard_derivatives: false
INFO[Main]: Irrlicht: GL_OES_stencil1: false
INFO[Main]: Irrlicht: GL_OES_stencil4: false
INFO[Main]: Irrlicht: GL_OES_stencil8: false
INFO[Main]: Irrlicht: GL_OES_stencil_wrap: false
INFO[Main]: Irrlicht: GL_OES_surfaceless_context: false
INFO[Main]: Irrlicht: GL_OES_texture_3D: false
INFO[Main]: Irrlicht: GL_OES_texture_cube_map: false
INFO[Main]: Irrlicht: GL_OES_texture_env_crossbar: false
INFO[Main]: Irrlicht: GL_OES_texture_float: false
INFO[Main]: Irrlicht: GL_OES_texture_float_linear: false
INFO[Main]: Irrlicht: GL_OES_texture_half_float: false
INFO[Main]: Irrlicht: GL_OES_texture_half_float_linear: false
INFO[Main]: Irrlicht: GL_OES_texture_mirrored_repeat: false
INFO[Main]: Irrlicht: GL_OES_texture_npot: false
INFO[Main]: Irrlicht: GL_OES_vertex_array_object: false
INFO[Main]: Irrlicht: GL_OES_vertex_half_float: false
INFO[Main]: Irrlicht: GL_OES_vertex_type_10_10_10_2: false
INFO[Main]: Irrlicht: GL_QCOM_alpha_test: false
INFO[Main]: Irrlicht: GL_QCOM_binning_control: false
INFO[Main]: Irrlicht: GL_QCOM_driver_control: false
INFO[Main]: Irrlicht: GL_QCOM_extended_get: false
INFO[Main]: Irrlicht: GL_QCOM_extended_get2: false
INFO[Main]: Irrlicht: GL_QCOM_performance_monitor_global_mode: false
INFO[Main]: Irrlicht: GL_QCOM_tiled_rendering: false
INFO[Main]: Irrlicht: GL_QCOM_writeonly_rendering: false
INFO[Main]: Irrlicht: GL_SUN_multi_draw_arrays: false
INFO[Main]: Irrlicht: GL_VIV_shader_binary: false
VERBOSE[Main]: Irrlicht: COGLES2ExtensionHandler::initExtensions - GL_MAX_TEXTURE_IMAGE_UNITS = 0
VERBOSE[Main]: Irrlicht: COGLES2ExtensionHandler::initExtensions - GL_MAX_TEXTURE_SIZE = 0
VERBOSE[Main]: Irrlicht: COGLES2ExtensionHandler::initExtensions - GL_ALIASED_LINE_WIDTH_RANGE = 0.000000
VERBOSE[Main]: Irrlicht: COGLES2ExtensionHandler::initExtensions - GL_ALIASED_POINT_SIZE_RANGE = 0.000000
Minetest Android client (with Irrlicht ogl es 1.9.0) works perfectly, and so it should work for raspberry pi
Is anybody up to take the challenge? If not... any tips on how I can continue getting Irrlicht (OpenGL ES) to work with Raspberry pi ?