Code Monkey home page Code Monkey logo

gl4es's Introduction

logo

GL4ES - OpenGL for GLES Hardware

gl4es build status

This is a library provide OpenGL 2.x functionality for GLES2.0 accelerated Hardware (and of course also support OpenGL 1.5 function, sometimes better than when using GLES 1.1 backend) There is also support for GLES 1.1 Hardware, emulating OpenGL 1.5, and some OpenGL 2.x+ extensions.

GL4ES is known to work on many platform: OpenPandora, ODroid, RaspberryPI (2 and 3 at least), PocketCHIP, "otherfruit"PI (like the OrangePI), Android, iOS, x86 and x86_64 Linux (tested using mesa-egl). There is also some WIP support for AmigaOS4, using experimental GLES2 driver for Warp3D.

This library is based on glshim (https://github.com/lunixbochs/glshim) but as now evolved far from it, with different feature set and objectives. Go check this lib if you need things like RemoteGL or TinyGLES (for software rendering).

The focus is on compatibility and speed with a wide selection of game and software.

It has been tested successfully of a large selection of games and software, including: Minecraft, OpenMW, SeriousSam (both First and Second Encounters), RVGL (ReVolt GL), TSMC (The Secret Maryo Chronicles), TORCS, SpeedDreams, GL-117, Foobillard(plus), half life 1&2, Blender 2.68 to name just a few. I have also some success with Linux port of XNA games, using either MonoGame or FNA.

Most function of OpenGL up to 1.5 are supported, with some notable exceptions:

  • Reading of Depth or Stencil buffer will not work
  • GL_FEEDBACK mode is not implemented
  • No Accum emulation

Some known general limitations:

  • GL_SELECT as some limitation in its implementation (for example, current Depth buffer or bounded texture are not taken into account, also custom vertex shader will not work here)
  • NPOT texture are supported, but not with GL_REPEAT / GL_MIRRORED, only GL_CLAMP will work properly (unless the GLES Hardware support NPOT)
  • Multiple Color attachment on Framebuffer are not supported
  • OcclusionQuery is implemented, but with a 0 bits precision
  • Probably many other things

Status of the GLES2 backend

  • The FPE (Fixed Pipeline Emulator) has most OpenGL 1.5 drawing call implemented
  • The Shader Conversion is really crude, so only simple shaders will work (especially, the implicit conversion float <-> int is not handled)
  • ARB_program are supported (converted on-the-fly to glsl shaders)
  • Lighting support double-side and color separation
  • FogCoord are supported, along with secondary color
  • An ES2 context should be usable (useful for SDL2)
  • OpenGL 2.x games that have been tested include: OpenRA, GZDoom, Danger from the Deep, SuperTuxKart 0.8.1, Hammerwatch, OpenMW, half life 2, many FNA & MonoGames games (FEZ, Towerfall Ascension, Stardew Valley, Dust, Owlboy, and many other), even some Unity3D games (Teslagrad, Colin McRea Rally remake and other)...
  • glxgears works, but FlatShade is not implemented (and will probably never be), so it's slightly different than using GLES1.1 or actual GL hardware
  • GL_TEXTURE_1D, GL_TEXTURE_3D and GL_TEXTURE_RECTANGLE_ARB are not yet supported in shaders (they are supported in fixed pipeline functions), and texture 3D are just a single 2D layer for now.
  • Program that link only a GL_FRAGMENT or GL_VERTEX shader are not supported yet.
  • Some VBO are used.

Status of the GLES1.1 backend

  • Framebuffer use FRAMEBUFFER_OES extension (that must be present in the GLES 1.1 stack)
  • Lighting doesn't support double-side or color separation
  • FogCoord or Secondary colors are not supported
  • GL_TEXTURE_3D are just a single 2D layer (the 1st layer).
  • VBO are supported, but they are emulated, even if VBO if supported in GLES1.1 driver

If you use gl4es in your project (as a static or dynamic link), please mention gl4es in you readme / about / whatever.


Compiling

How to compile and per-platform specific comment can be found here


GLU

Standard GLU do works without any issues. You can find a version here if you need one.


Installation

Put lib/libGL.so.1 in your LD_LIBRARY_PATH. Beware that GL4ES is meant to replace any libGL you can have on your system (like Mesa for example)


Usage

There are many environment variable to control gl4es behavior, also usable at runtime using glHint(...).

See here for all variables and what they do.


Media (what is working already)

Some screenshot and youtube links of stuffs that works here


Version history

The change log is here

gl4es's People

Contributors

a1batross avatar abasgames avatar daytona675x avatar frankwu100 avatar gfwilliams avatar glebm avatar icenowy avatar iscle avatar johnnyonflame avatar jwalt avatar khanhduytran0 avatar lephilousophe avatar levinli303 avatar lunixbochs avatar martinmullins avatar mathias-boulay avatar matwey avatar mittorn avatar okuoku avatar parasti avatar pbdot avatar pcercuei avatar ptitseb avatar rajdakin avatar raziel- avatar rzr avatar shiptux avatar weimzh avatar xyzz avatar yjh-styx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gl4es's Issues

test-case: general, endian or amigaos4 specific #3

After spending 2 days for porting legacy test-case opengl examples, found again one which didn't works correctly. That can be of course as usuall problems of amigaos4, or endianes, or they can be general as well.

So, test case demonstrates using mipmaps for texture maps. To overtly show the effect of mipmaps, each mipmap reduction level has a solidly colored, contrasting texture image. Thus, the quadrilateral which is drawn is drawn with several different colors.

There is source code (amigaos4/ogles2):
http://kas1e.mikendezign.com/aos4/gl4es/tests/testcase_3/mipmap_gl4es.c

By keys '+' and '-' you change the size (and colors should be changed as wel).

There is image of how it looks like on our legacy opengl1.2:
http://kas1e.mikendezign.com/aos4/gl4es/tests/testcase_3/mipmap_mgl.jpg

There is image (wrong) how it looks like over gl4es:
http://kas1e.mikendezign.com/aos4/gl4es/tests/testcase_3/mipmap_gl4es.jpg
Pressing on '+' and "-" change only size, but not color. Color always yellow

There is debug output from gl4es version:
http://kas1e.mikendezign.com/aos4/gl4es/tests/testcase_3/debug.txt

Some test-case lockup

There is test case i do check for now on amigaos4:
http://kas1e.mikendezign.com/aos4/gl4es/tests/drawbuffer_gl4es.c

Once i run it, after few loops of DrawBox() , it crashes.

It works through when pure opengl used (some old 1.1 version which we have), but can be that bug in the code as well. There is only defined 6 normals for 8 vertices, but probably that should't cause crash ?

@ptitSeb
Can you check plz that GL code on your own (with SDL or something) , to see if that code works at all for on gl4es, so we can then know if it amigaos4 only issue or not.

Thanks!

SDL2 alpha problem?

Hi,

I've just found an interesting issue, trying out nimgame2's demo No. 1.

In short, SDL2/GLES (or MESA OpenGL, minus the fps) looks like this:
gles

whereas SDL2/OpenGL + gl4es like this:
gl

I was running @16 bpp and there should probably be no difference between the two scenarios. (what about performance-wise?)

I suspect it's not going to be necessary for you to dabble in nim to get to the bottom of the issue but, just in case, here's the nim distro tarball I'm using on my Odroid.

Is support for glEnableVertexAttribArray missing ?

Hi ptitSeb :)

I tried to run some OpenGL application on the Pandora through your gl4es wrapper (v.0.9.5), but it failed with the following error message:

agp lookup(glEnableVertexAttribArray) failed, missing req. symbol.
Aborted

Is it something you could fix in a future version ?

Cheers, Magic Sam from the Open Pandora community

Fake some server strings

glXQueryServerString will return some empty strings.

This will cause some programs to fail.

For example, libepoxy, which used by clutter and gtk, uses server's version string to parse GL version, and will fail on GL4ES.

Rockchip (Mali-T760) Segmentation Fault

es2_info and es2gears work well, but I can't get glxinfo working. Original lunixbochs/glshim branch worked well, but I'm going for OpenGL 2.0.

I compiled gl4es using ODROID option.

$ es2_info
EGL_VERSION: 1.4 Midgard-"r12p0-04rel0"
EGL_VENDOR: ARM
EGL_EXTENSIONS:
    , EGL_KHR_image_pixmap, EGL_KHR_partial_update,  EGL_KHR_config_attribs, 
    EGL_KHR_image, EGL_KHR_image_base, EGL_KHR_fence_sync, EGL_KHR_wait_sync, 
    EGL_KHR_gl_colorspace, EGL_KHR_get_all_proc_addresses, 
    EGL_IMG_context_priority, EGL_ARM_pixmap_multisample_discard, 
    EGL_KHR_gl_texture_2D_image, EGL_KHR_gl_renderbuffer_image, 
    EGL_KHR_create_context, EGL_KHR_surfaceless_context, 
    EGL_KHR_gl_texture_cubemap_image, EGL_EXT_create_context_robustness, 
    EGL_KHR_cl_event2
EGL_CLIENT_APIS: OpenGL_ES
GL_VERSION: OpenGL ES 3.2 v1.r12p0-04rel0.4280adac90751b4d03519963106fb083
GL_RENDERER: Mali-T760
GL_EXTENSIONS:
    GL_ARM_rgba8, GL_ARM_mali_shader_binary, GL_OES_depth24, 
    GL_OES_depth_texture, GL_OES_depth_texture_cube_map, 
    GL_OES_packed_depth_stencil, GL_OES_rgb8_rgba8, GL_EXT_read_format_bgra, 
    GL_OES_compressed_paletted_texture, GL_OES_compressed_ETC1_RGB8_texture, 
    GL_OES_standard_derivatives, GL_OES_EGL_image, GL_OES_EGL_image_external, 
    GL_OES_EGL_image_external_essl3, GL_OES_EGL_sync, GL_OES_texture_npot, 
    GL_OES_vertex_half_float, GL_OES_required_internalformat, 
    GL_OES_vertex_array_object, GL_OES_mapbuffer, 
    GL_EXT_texture_format_BGRA8888, GL_EXT_texture_rg, 
    GL_EXT_texture_type_2_10_10_10_REV, GL_OES_fbo_render_mipmap, 
    GL_OES_element_index_uint, GL_EXT_shadow_samplers, 
    GL_OES_texture_compression_astc, GL_KHR_texture_compression_astc_ldr, 
    GL_KHR_texture_compression_astc_hdr, 
    GL_KHR_texture_compression_astc_sliced_3d, GL_KHR_debug, 
    GL_EXT_occlusion_query_boolean, GL_EXT_disjoint_timer_query, 
    GL_EXT_blend_minmax, GL_EXT_discard_framebuffer, 
    GL_OES_get_program_binary, GL_OES_texture_3D, GL_EXT_texture_storage, 
    GL_EXT_multisampled_render_to_texture, GL_OES_surfaceless_context, 
    GL_OES_texture_stencil8, GL_EXT_shader_pixel_local_storage, 
    GL_ARM_shader_framebuffer_fetch, 
    GL_ARM_shader_framebuffer_fetch_depth_stencil, GL_ARM_mali_program_binary, 
    GL_EXT_sRGB, GL_EXT_sRGB_write_control, GL_EXT_texture_sRGB_decode, 
    GL_KHR_blend_equation_advanced, GL_KHR_blend_equation_advanced_coherent, 
    GL_OES_texture_storage_multisample_2d_array, GL_OES_shader_image_atomic, 
    GL_EXT_robustness, GL_EXT_draw_buffers_indexed, 
    GL_OES_draw_buffers_indexed, GL_EXT_texture_border_clamp, 
    GL_OES_texture_border_clamp, GL_EXT_texture_cube_map_array, 
    GL_OES_texture_cube_map_array, GL_OES_sample_variables, 
    GL_OES_sample_shading, GL_OES_shader_multisample_interpolation, 
    GL_EXT_shader_io_blocks, GL_OES_shader_io_blocks, 
    GL_EXT_tessellation_shader, GL_OES_tessellation_shader, 
    GL_EXT_primitive_bounding_box, GL_OES_primitive_bounding_box, 
    GL_EXT_geometry_shader, GL_OES_geometry_shader, 
    GL_ANDROID_extension_pack_es31a, GL_EXT_gpu_shader5, GL_OES_gpu_shader5, 
    GL_EXT_texture_buffer, GL_OES_texture_buffer, GL_EXT_copy_image, 
    GL_OES_copy_image, GL_EXT_color_buffer_half_float, 
    GL_EXT_color_buffer_float, GL_EXT_YUV_target, GL_OVR_multiview, 
    GL_OVR_multiview2, GL_OVR_multiview_multisampled_render_to_texture, 
    GL_KHR_robustness, GL_KHR_robust_buffer_access_behavior, 
    GL_EXT_draw_elements_base_vertex, GL_OES_draw_elements_base_vertex
$ es2gears
EGL_VERSION = 1.4 Midgard-"r12p0-04rel0"
vertex shader info: 
fragment shader info: 
info: 
280 frames in 5.0 seconds = 55.877 FPS

But glxinfo dies.

$ glxinfo
LIBGL: Initialising gl4es
LIBGL: v1.0.2 built on Nov  2 2017 12:30:52
LIBGL: Using GLES 1.1 backend
LIBGL:loaded: libGLESv1_CM.so
LIBGL:loaded: libEGL.so
LIBGL: Using GLES 1.1 backend
LIBGL: Extension GL_OES_blend_subtract detected and used
LIBGL: Extension GL_OES_blend_func_separate detected and used
LIBGL: Extension GL_OES_blend_equation_separate detected and used
LIBGL: Extension GL_EXT_blend_minmax detected and used
LIBGL: Extension GL_OES_framebuffer_object detected and used
LIBGL: Extension GL_OES_point_sprite detected and used
LIBGL: Extension GL_OES_point_size_array detected
LIBGL: Extension GL_OES_element_index_uint detected
LIBGL: Extension GL_OES_packed_depth_stencil detected and used
LIBGL: Extension GL_OES_depth24 detected and used
LIBGL: Extension GL_OES_rgb8_rgba8 detected and used
LIBGL: Extension GL_EXT_texture_format_BGRA8888 detected and used
LIBGL: Extension GL_OES_texture_cube_map detected and used
LIBGL: Extension GL_OES_draw_texture detected and used
LIBGL: Max texture size: 8192
LIBGL: Texture Units: 8(8), Max lights: 8, Max planes: 1
LIBGL: Implementation Read is GL_RGBA/GL_UNSIGNED_BYTE
LIBGL: sRGB surface supported
LIBGL: Targeting OpenGL 1.5
LIBGL: Current folder is:/usr/lib/arm-linux-gnueabihf
name of display: :3.0
glXGetProcAddress: glGetProgramivARB not found.
glX stub: glGetStringi
glXGetProcAddress: glGetConvolutionParameteriv not found.
[1]    18019 segmentation fault (core dumped)  glxinfo

Libraries are properly linked. (glshim/libGL.so.1 is gl4es)

$ ldd /usr/bin/glxinfo
	libGL.so.1 => /usr/lib/glshim/libGL.so.1 (0xafc73000)
	libX11.so.6 (0xafb82000)
	libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0xafa7d000)
	/lib/ld-linux-armhf.so.3 (0xafd30000)
	libm.so.6 => /lib/arm-linux-gnueabihf/libm.so.6 (0xafa05000)
	libdl.so.2 => /lib/arm-linux-gnueabihf/libdl.so.2 (0xaf9f2000)
	libgcc_s.so.1 => /lib/arm-linux-gnueabihf/libgcc_s.so.1 (0xaf9ca000)
	libxcb.so.1 (0xaf9a6000)
	libXau.so.6 (0xaf99b000)
	libXdmcp.so.6 (0xaf987000)

glxgears does not segfault, but with only black screen

$ glxgears
LIBGL: Initialising gl4es
LIBGL: v1.0.2 built on Nov  2 2017 12:30:52
LIBGL: Using GLES 1.1 backend
LIBGL:loaded: libGLESv1_CM.so
LIBGL:loaded: libEGL.so
LIBGL: Using GLES 1.1 backend
LIBGL: Extension GL_OES_blend_subtract detected and used
LIBGL: Extension GL_OES_blend_func_separate detected and used
LIBGL: Extension GL_OES_blend_equation_separate detected and used
LIBGL: Extension GL_EXT_blend_minmax detected and used
LIBGL: Extension GL_OES_framebuffer_object detected and used
LIBGL: Extension GL_OES_point_sprite detected and used
LIBGL: Extension GL_OES_point_size_array detected
LIBGL: Extension GL_OES_element_index_uint detected
LIBGL: Extension GL_OES_packed_depth_stencil detected and used
LIBGL: Extension GL_OES_depth24 detected and used
LIBGL: Extension GL_OES_rgb8_rgba8 detected and used
LIBGL: Extension GL_EXT_texture_format_BGRA8888 detected and used
LIBGL: Extension GL_OES_texture_cube_map detected and used
LIBGL: Extension GL_OES_draw_texture detected and used
LIBGL: Max texture size: 8192
LIBGL: Texture Units: 8(8), Max lights: 8, Max planes: 1
LIBGL: Implementation Read is GL_RGBA/GL_UNSIGNED_BYTE
LIBGL: sRGB surface supported
LIBGL: Targeting OpenGL 1.5
LIBGL: Current folder is:/usr/lib/arm-linux-gnueabihf
Running synchronized to the vertical refresh.  The framerate should be
approximately the same as the monitor refresh rate.

When I try to launch other few programs, they segfault. lunixbochs/glshim branch did not segfault, but with an assertion error.

$ chromium-browser
LIBGL: Initialising gl4es
LIBGL: v1.0.2 built on Nov  2 2017 12:30:52
LIBGL: Using GLES 1.1 backend
LIBGL:loaded: libGLESv1_CM.so
LIBGL:loaded: libEGL.so
LIBGL: Using GLES 1.1 backend
[1]    19301 segmentation fault (core dumped)  chromium-browser

Any ideas??

quake3 on amigaos4

@ptitSeb
Was able to build quake3 from your sources, for both, minigl and gl4es. In minigl version everything looks and works correct. In gl4es version, games starts , first image anymation come fine (that one with ID shoot in), and then when there should be shown "CD KEY , please enter your cd key, ACCEPT", i have instead nothing , just still ID there. If i then press "enter" again, so to go to menu, then i see, that something start changes visually, but all distorted and wrong. Have a look at screenshot:

http://kas1e.mikendezign.com/aos4/gl4es/games/quake3/first_run.jpg

And there is console output:
http://kas1e.mikendezign.com/aos4/gl4es/games/quake3/first_run_console_output.txt

At moment it is yesterdays's version with enabled workoround we do and almost without debug enabled (only fpe one seems so).

So i will for now try to build latest commit version (where we have no workorounds), as wel as will enable whole debug everywhere.

test-case: general or amigaos4 specific #5

While trying to find roots of those quakes3's problems, give a go for some other test cases and found some differences.

There is test-case: http://kas1e.mikendezign.com/aos4/gl4es/tests/testcase_5/warp_gl4es.c
(note it have "data" directory, with files flare.ppm and stars.ppm, they are need it for that example)

With legacy minigl i have that after running:
http://kas1e.mikendezign.com/aos4/gl4es/tests/testcase_5/warp_mgl.jpg

With gl4es version i have that:
http://kas1e.mikendezign.com/aos4/gl4es/tests/testcase_5/warp_gl4es.jpg

Probably can be again, amigaos4 only issues, but worth to note, as maybe it gl4es diffs as well.

FB pbuffer mode broken on a framebuffer-only device?

Continuing from #27, here's what gl4es tells us after enabling DEBUG in framebuffer.c and glx.c;

LIBGL_FB=1 glxgears produces a black window and this output:

LIBGL: Initialising gl4es
LIBGL: v0.9.7 built on Jun 18 2017 21:20:56
LIBGL: framebuffer output enabled
LIBGL:loaded: libGLESv1_CM.so
LIBGL:loaded: libEGL.so
LIBGL: Extension glBlendColor found and used
LIBGL: Extension GL_OES_point_sprite detected and used
LIBGL: Extension GL_OES_point_size_array detected
LIBGL: Extension GL_OES_framebuffer_object detected and used
LIBGL: Extension GL_OES_packed_depth_stencil detected and used
LIBGL: Extension GL_OES_depth24 detected and used
LIBGL: Extension GL_OES_rgb8_rgba8 detected and used
LIBGL: Extension GL_EXT_texture_format_BGRA8888 detected and used
LIBGL: Extension GL_OES_depth_texture detected and used
LIBGL: Extension GL_OES_texture_cube_map detected and used
LIBGL: Extension GL_OES_draw_texture detected and used
LIBGL: Max texture size: 4096
LIBGL: Texture Units: 8, Max lights: 8, Max planes: 1
LIBGL: Implementation Read is GL_RGB/GL_UNSIGNED_SHORT_5_6_5
LIBGL: Current folder is:/home/odroid/gl4es
glXChooseVisual(0x235d6760, 0, 0x7ffe098c98)
glXChooseFBConfig(0x235d6760, 0, 0x7ffe098c98, 0x7ffe098b24)
FBConfig redBits=1
FBConfig greenBits=1
FBConfig blueBits=1
FBConfig depthBits=1
glXCreateContext(0x235d6760, 0x235e5f50, (nil), 1), latest_visual=0x235e5f50, fbcontext_count=0 => 0x235e5fe0
LIBGL: ERROR: EGL Error detected: EGL_BAD_MATCH (0x0)
glXMakeCurrent(0x235d6760, 0x2c00002, 0x235e5fe0), isPBuffer(drawable)=0, context->drawable=(nil), context->eglSurface=(nil) => False
glXQueryExtensionString(0x235d6760, 0)
glXQueryDrawable(0x235d6760, 0x2c00002(0), GLX_SWAP_INTERVAL_EXT, 0x7ffe098e68 = 0)
300109 frames in 5.0 seconds = 60021.801 FPS
299919 frames in 5.0 seconds = 59983.754 FPS

whereas LIBGL_FB=2 also this:

glXChooseVisual(0x1cc2e760, 0, 0x7fdf99b438)
glXChooseFBConfig(0x1cc2e760, 0, 0x7fdf99b438, 0x7fdf99b2c4)
FBConfig redBits=1
FBConfig greenBits=1
FBConfig blueBits=1
FBConfig depthBits=1
glXCreateContext(0x1cc2e760, 0x1cc3df50, (nil), 1), latest_visual=0x1cc3df50, fbcontext_count=0 => 0x1cc3dfe0
LIBGL: ERROR: EGL Error detected: EGL_BAD_MATCH (0x0)
glXMakeCurrent(0x1cc2e760, 0x2c00002, 0x1cc3dfe0), isPBuffer(drawable)=0, context->drawable=(nil), context->eglSurface=(nil) => False
glXQueryExtensionString(0x1cc2e760, 0)
glXQueryDrawable(0x1cc2e760, 0x2c00002(0), GLX_SWAP_INTERVAL_EXT, 0x7fdf99b608 = 0)
LIBGL: warning, gles_glBindFramebuffer is NULL
LIBGL: warning, gles_glBindFramebuffer is NULL
LIBGL: warning, gles_glCheckFramebufferStatus is NULL
301370 frames in 5.0 seconds = 60273.914 FPS

and finally, LIBGL_FB=3 actually produces some moving sprites inside of the window:

glXChooseVisual(0x1a95c760, 0, 0x7fe9c253d8)
glXChooseFBConfig(0x1a95c760, 0, 0x7fe9c253d8, 0x7fe9c25264)
FBConfig redBits=1
FBConfig greenBits=1
FBConfig blueBits=1
FBConfig depthBits=1
glXCreateContext(0x1a95c760, 0x1a96bf50, (nil), 1), latest_visual=0x1a96bf50, fbcontext_count=0 => 0x1a96bfe0
glXMakeCurrent(0x1a95c760, 0x2c00002, 0x1a96bfe0), isPBuffer(drawable)=0, context->drawable=(nil), context->eglSurface=(nil)XGetGeometry gives 300x300 for drawable 0x2c00002
 => True
glXQueryExtensionString(0x1a95c760, 0)
glXQueryDrawable(0x1a95c760, 0x2c00002(1), GLX_SWAP_INTERVAL_EXT, 0x7fe9c255a8 = 0)
readfboBegin, fbo status read=0, draw=0, main=0, current=0
readfboEnd, fbo status read=0, draw=0, main=0, current=0

This is being tried on a system running at 720p/24bpp. The shim was compiled for ODROID which might be a wrong choice for a framebuffer system, as trying to use X11 fails with:

glXCreateContext(0x3c02a760, 0x3c039f50, (nil), 1), latest_visual=0x3c039f50, fbcontext_count=0 => (nil)

Anything actionable here or is the system simply broken?

Segfault on some gl and sdl apps

For example RetroArch works with gl backend, but not with sdl. Gens/gs sdl backend doesn't work. ScummVM which uses sdl is working. I've tried also sdlarch and nanoarch. Both are crashing with segfault.
Message that could be helpful [inf] Frontend supports RGB565 - will use that instead of XRGB1555.
Also, strace output of the nanoarch https://drive.google.com/file/d/1U2be60bBX3DEpJraNjiDhlR4o-FunZ-1/view
And I have only 96MB accessible to GPU, may that be a problem?

Gamma

Re-Bonjour!

Je suis tres content d'utiliser le shim sur de nombreux applications. J'aimerais savoir si on pourrait faire fonctionner la ligne LIBGL_GAMMA sur ODROID. Je l'ai essayer avec mon program sans succes. Si je jouerai sur un monitor d'ordinateur, j'ai pas de probleme. Mais comme j'utilise mon ODROID sur une TV, le gamma est trop bas est je n'y voit rien. C'est pour cette raison je cite ceci ici et qu'il y a pas mieux moyen de te rejoindre. Merci beaucoup mon ami,

Benchmarking the library

I've recently started compiling glshim/gl4es with LTO and compared to a normally built glshim's libGL (ca. 520kB) it comes out at 620-700 kB depending on gcc version. (probably lots of inlining)

It would be great to actually check which optimizations help/hurt performance and whether the increased size incurs any penalty.

Might the library be benchmarked excluding other factors like X or GLES drivers?

CC: @lunixbochs

test-case: general, endian or amiaos4 specific #2

Ok ! Next round :)

I have an example, which uses evaluators to generate a curved surface and automatically generated texture coordinates. That can be good test case probably and for GL4ES too.

AmigaOS4 GL4ES source: http://kas1e.mikendezign.com/aos4/gl4es/tests/testcase_2/texturesurf_gl4es.c

Now, with our old opengl1.2 it looks good, like this:
http://kas1e.mikendezign.com/aos4/gl4es/tests/testcase_2/texturesurf_mgl.jpg

Over gl4es it looks like this:
http://kas1e.mikendezign.com/aos4/gl4es/tests/testcase_2/texturesurf_gl4es.jpg

Full debug log:
http://kas1e.mikendezign.com/aos4/gl4es/tests/testcase_2/texturesurf_debug.txt

test-case: general or amigaos4 specific #4

There is source of morph3d whic shows 3D morphing objects.
I tested that over legacy opengl, all is fine. By default some figure fly around, and by case 1,2,3,4,5 i can change geometry. Also by space and enter can change the things, too. With GL4ES it show black screen.

So, there is source:
http://kas1e.mikendezign.com/aos4/gl4es/tests/testcase_4/morph3d_gl4es.c

There is debug output:
http://kas1e.mikendezign.com/aos4/gl4es/tests/testcase_4/morph3d_debug.txt

From logs i see that shaders fail, will try to check if they compiles over our shader's compiler at all..

Crashes with "Segmentation fault" (Mali-T604 MP4)

GL4ES v0.9.3 crashes on some programs that I've tried (stepmania 5.0.12, performous, and minecraft but not glxgears) with "Segmentation fault".

I tried to configure it using -DPANDORA=1, -DBCMHOST=1, and -DODROID=1 on cmake, but it still has the same problem.

gl4es 1.0+ regressions

The issue has turned into a regressions report so I'll open a new one for Texture3d support.

So, I've heard about this new project called gl4es over there and thought I'd bring up the issue here, lest it be 4gotten :O

Great name change, by the way :)

In retroarch text is not correctly rendered

I'm trying to run retroarch on gl4es on Mesa libGLESv2.

The following error message appeared:

Mesa 17.1.4 implementation error: Unexpected incomplete framebuffer in _mesa_meta_GenerateMipmap()
Please report at https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa

No thread safety

I tested the thread safety of gl4es with glthreads program in the mesa-demos package.

It hangs.

icenowy@x220i [ gl4es@master ] $ LD_LIBRARY_PATH=~/git-repos/gl4es/build/lib LIBGL_ES=2 glthreads 
LIBGL: Initialising gl4es
LIBGL: v1.0.2 built on Oct 22 2017 19:23:58
LIBGL: Using GLES 2.0 backend
LIBGL:loaded: libGLESv2.so
LIBGL:loaded: libEGL.so
LIBGL: Using GLES 2.0 backend
LIBGL: Extension GL_EXT_blend_minmax detected and used
LIBGL: Extension glBlendColor found and used
LIBGL: Extension GL_OES_element_index_uint detected
LIBGL: FBO are in core, and so used
LIBGL: Extension GL_OES_packed_depth_stencil detected and used
LIBGL: Extension GL_OES_depth24 detected and used
LIBGL: Extension GL_OES_rgb8_rgba8 detected and used
LIBGL: Extension GL_EXT_multi_draw_arrays detected and used
LIBGL: Extension GL_EXT_texture_format_BGRA8888 detected and used
LIBGL: Extension GL_OES_depth_texture detected and used
LIBGL: Extension GL_EXT_texture_rg detected
LIBGL: Extension GL_OES_texture_float detected
LIBGL: Extension GL_EXT_frag_depth detected and used
LIBGL: Max vertex attrib: 16
LIBGL: Max texture size: 8192
LIBGL: Texture Units: 8(8), Max lights: 8, Max planes: 6
LIBGL: Implementation Read is GL_BGRA/GL_UNSIGNED_BYTE
LIBGL: Targeting OpenGL 2.0
LIBGL: Current folder is:/home/icenowy/git-repos/gl4es
glthreads: test of GL thread safety (any key = exit)
Usage:
  glthreads [options]
Options:
   -display DISPLAYNAME  Specify display string
   -n NUMTHREADS  Number of threads to create
   -p  Use a separate display connection for each thread
   -l  Use application-side locking
   -t  Enable texturing
Keyboard:
   Esc  Exit
   t    Change texture image (requires -t option)
   a    Toggle animation
   s    Step rotation (when not animating)
glthreads: No explict locking.
glthreads: Single display connection.
XInitThreads() returned 1 (success)
glthreads: creating windows
glthreads: creating threads
glthreads: Created thread 0x7f02c8b66700
glthreads: Created thread 0x7f02c0365700
glthreads: 0: GL_RENDERER = GLES_CM wrapper
glthreads: 1: GL_RENDERER = GLES_CM wrapper
Segmentation fault (core dumped)
icenowy@x220i [ gl4es@master ] ! glthreads 
glthreads: test of GL thread safety (any key = exit)
Usage:
  glthreads [options]
Options:
   -display DISPLAYNAME  Specify display string
   -n NUMTHREADS  Number of threads to create
   -p  Use a separate display connection for each thread
   -l  Use application-side locking
   -t  Enable texturing
Keyboard:
   Esc  Exit
   t    Change texture image (requires -t option)
   a    Toggle animation
   s    Step rotation (when not animating)
glthreads: No explict locking.
glthreads: Single display connection.
XInitThreads() returned 1 (success)
glthreads: creating windows
glthreads: creating threads
glthreads: Created thread 0x7f2632823700
glthreads: Created thread 0x7f2632022700
glthreads: 0: GL_RENDERER = Mesa DRI Intel(R) Sandybridge Mobile 
glthreads: 1: GL_RENDERER = Mesa DRI Intel(R) Sandybridge Mobile 

Missing floors and textures

Hello!
I tried using GDB with the LIBGL and the program I'm trying to run but the GDB program states nothing out of place while in-game, the floor and some textures are missing, even though the same textures elsewhere in the game would be perfectly ok. I've also tried debugging the shared library itself and again nothing is out of place. Maybe what the game is looking for is non-existant in the shim?
Here's a picture http://imgur.com/XUy8rx9
and a GDB output http://pastebin.com/XKxQ0cXi

As you can see in the picture, under the green armor, the texture is gone, right beside the armor,
the same texture is used and is visible. My guess would be brightmaps. But I can't confirm that since no GDB output from either shim or program can tell me what is wrong.

'remap_pixel()' function takes up to 20% running time on Android device

While I successfully run gl4es on Android device, in the profile of my ndk-based APP, the cost of running time for the function 'remap_pixel()' reach up to 20% of the whole running time.

 Flat profile:
 
 Each sample counts as 0.01 seconds.
   %   cumulative   self              self     total           
  time   seconds   seconds    calls   s/call   s/call  name    
  25.93     24.19    24.19     3692     0.01     0.01  bool PTAMM::Bundle::Do_LM_Step<PTAMM::Tukey>(bool*)
  22.70     45.37    21.18                             remap_pixel
  10.78     55.43    10.06                             profCount
   5.90     60.93     5.50                             __gnu_mcount_nc
   2.92     63.65     2.72 32623260     0.00     0.00  PTAMM::Bundle::ProjectAndFindSquaredError(PTAMM::Meas&)
   2.43     65.92     2.27     3805     0.00     0.00  double PTAMM::Bundle::FindNewError<PTAMM::Tukey>()

The cost is too much, so what can I do to reduce or avoid it ?

Build instructions don't mention which toolchains are known to successfully build this

I'm trying to build a copy of this to experiment with pairing it with qemu-i386 on my Pandora but I've been having trouble with the build instructions.

Normally, I use a copy of sebt3's Yactfeau toolchain for cross-compiling, but this is as far as I can get with it in this case.

export CC=/home/ssokolow/opt/pandora-dev/arm-2011.09/bin/pandora-gcc CXX=/home/ssokolow/opt/pandora-dev/arm-2011.09/bin/pandora-g++
ssokolow@monolith gl4es [master] % cmake . -DPANDORA=1; make GL                                                                                                                      
-- The C compiler identification is GNU 4.6.1
-- The CXX compiler identification is GNU 4.6.1
-- Check for working C compiler: /home/ssokolow/opt/pandora-dev/arm-2011.09/bin/arm-none-linux-gnueabi-gcc
-- Check for working C compiler: /home/ssokolow/opt/pandora-dev/arm-2011.09/bin/arm-none-linux-gnueabi-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /home/ssokolow/opt/pandora-dev/arm-2011.09/bin/pandora-g++
-- Check for working CXX compiler: /home/ssokolow/opt/pandora-dev/arm-2011.09/bin/pandora-g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ssokolow/src/read-only/gl4es
Scanning dependencies of target GL
[  2%] Building C object src/CMakeFiles/GL.dir/gl/array.c.o
In file included from /home/ssokolow/src/read-only/gl4es/include/EGL/egl.h:36:0,
                 from /home/ssokolow/src/read-only/gl4es/src/gl/gl.h:4,
                 from /home/ssokolow/src/read-only/gl4es/src/gl/array.h:1,
                 from /home/ssokolow/src/read-only/gl4es/src/gl/array.c:1:
/home/ssokolow/src/read-only/gl4es/include/EGL/eglplatform.h:89:22: fatal error: X11/Xlib.h: No such file or directory
compilation terminated.
make[3]: *** [src/CMakeFiles/GL.dir/gl/array.c.o] Error 1
make[2]: *** [src/CMakeFiles/GL.dir/all] Error 2
make[1]: *** [src/CMakeFiles/GL.dir/rule] Error 2
make: *** [GL] Error 2

I'm assuming that, since you didn't mention installing additional dependencies, you develop against a different toolchain which already includes the requisite headers... but which one?

GLU functions link error

I use gl4es in android ndk, after ndk-build I got such linking errors:

error: undefined reference to 'gluNewQuadric'
error: undefined reference to 'gluSphere'
error: undefined reference to 'gluDeleteQuadric'

Does gl4es support functions like gluSphere() ? Or did I got something wrong ?

Build without EGL or X11

Want to port gl4es to some obscure platform, which have no EGL or X11, but its own API for creating context and co, and have some questions:

Lately port REGAL and it wasn't as good as i expected. Simple things do not works as expected while others do. So i want to try gl4es as it seems only one project which in develop and looks good enough.

So, i can buld Regal as static library, just with: -DREGAL_SYS_ES2=1 -DREGAL_STATIC_ES2 -DREGAL_SYS_X11=0 -DREGAL_SYS_GLX=0 -DREGAL_SYS_EGL=0

Then, in GL programm i just change include <GL/gl.h> on include <GL/Regal.h>, and link binary against -lgles2 , and all works.

So i want to do the same for gl4es. Is it possible ? All i need, its static library, which will worry about ogl calls and transfer them to ogles context (which i create myself, by own api) , without reling in any way on X11 or EGL (as i can for myself create windows, context and handle buttons and stuff).

Thanks in advance for help !

How to call initialize_gl4es()?

Hello:
I want use your gl4es instead Android NDK's GLES in my android project for many functions that OpenGLES not supported.
I have compiled gl4es to a static lib by the Android.mk ,But i dont't know how to init it in my Android environment. I think call the initialize_gl4es() can init but no any head file to declare this function.I try to declare it in init.h like:
image

then I compiled again, and use it like:
image
but when run my project it occur error like:
image
In the Android.mk i try open or close the code:

LOCAL_CFLAGS += -DNO_INIT_CONSTRUCTOR

but it still useless.
I can't make sure you understand what I mean,I hope you can provide me with some useful solutions.
Thk.

NPOT causes small visual glitch in naev

NPOT textures has to be ticked in the video settings and then:

$ LIBGL_NPOT=2 naev
LIBGL: Initialising glshim
LIBGL:loaded: libGLESv1_CM.so
LIBGL:loaded: libEGL.so
 Naev v0.6.1
 Sea of Darkness
LIBGL: built on Nov  1 2016 21:30:52
LIBGL: Extension GL_OES_point_sprite detected and used
LIBGL: Extension GL_OES_point_size_array detected
LIBGL: Extension GL_OES_framebuffer_object detected and used
LIBGL: Extension GL_OES_packed_depth_stencil detected and used
LIBGL: Extension GL_OES_depth24 detected and used
LIBGL: Extension GL_OES_rgb8_rgba8 detected and used
LIBGL: Extension GL_EXT_texture_format_BGRA8888 detected
LIBGL: Extension GL_OES_depth_texture detected and used
LIBGL: Max texture size: 4096
LIBGL: Texture Units: 8, Max lights: 8
LIBGL: Implementation Read is GL_RGB/GL_UNSIGNED_SHORT_5_6_5
LIBGL: Expose GL_ARB_texture_non_power_of_two extension
LIBGL: Current folder is:/home/odroid
libGL: warning, gles_glBlendFuncSeparate is NULL

leads to clearly visible planet tiles outlines (or whatever that is):
naev-glitch

Memory errors reported by `-fsanitize=address` instrumentation

$ LD_PRELOAD=/usr/gcc7/lib/libasan.so.4 foobillardplus

==24249==ERROR: AddressSanitizer: global-buffer-overflow on address 0xb6994c58 at pc 0xb694e98c bp 0xbe88f61c sp 0xbe88f614
READ of size 4 at 0xb6994c58 thread T0
    #0 0xb694e98b in gl4es_glPolygonOffset ../src/gl/wrap/gles.c:1326

0xb6994c58 is located 40 bytes to the left of global variable '*.LC2' defined in '../src/gl/wrap/gles.c' (0xb6994c80) of size 17
  '*.LC2' is ascii string 'glTexParameterxv'
0xb6994c58 is located 0 bytes to the right of global variable 'StageExclusive' defined in '../src/gl/wrap/../list.h:32:12' (0xb6994c00) of size 88
SUMMARY: AddressSanitizer: global-buffer-overflow ../src/gl/wrap/gles.c:1326 in gl4es_glPolygonOffset
Shadow bytes around the buggy address:
  0x36d32930: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x36d32940: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x36d32950: 03 f9 f9 f9 f9 f9 f9 f9 00 00 00 00 00 00 00 00
  0x36d32960: 00 00 00 00 00 00 00 00 00 00 00 00 00 05 f9 f9
  0x36d32970: f9 f9 f9 f9 00 00 00 00 00 02 f9 f9 f9 f9 f9 f9
=>0x36d32980: 00 00 00 00 00 00 00 00 00 00 00[f9]f9 f9 f9 f9
  0x36d32990: 00 00 01 f9 f9 f9 f9 f9 00 00 00 00 00 06 f9 f9
  0x36d329a0: f9 f9 f9 f9 00 00 f9 f9 f9 f9 f9 f9 00 00 00 00
  0x36d329b0: 00 05 f9 f9 f9 f9 f9 f9 00 00 01 f9 f9 f9 f9 f9
  0x36d329c0: 00 00 00 00 00 06 f9 f9 f9 f9 f9 f9 00 00 01 f9
  0x36d329d0: f9 f9 f9 f9 00 00 00 00 00 06 f9 f9 f9 f9 f9 f9
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==24249==ABORTING

$ LD_PRELOAD=/usr/gcc7/lib/libasan.so.4 billard-gl

==24446==ERROR: AddressSanitizer: global-buffer-overflow on address 0xb693fd38 at pc 0xb68740f4 bp 0xbe91fb14 sp 0xbe91fb0c
READ of size 4 at 0xb693fd38 thread T0
    #0 0xb68740f3 in gl4es_glMultMatrixf ../src/gl/matrix.c:185
    #1 0xb68740f3 in gl4es_glTranslatef ../src/gl/matrix.c:224
    #2 0x1cc0d  (/usr/games/billard-gl+0x1cc0d)
    #3 0x15263  (/usr/games/billard-gl+0x15263)
    #4 0x2404b  (/usr/games/billard-gl+0x2404b)

0xb693fd38 is located 40 bytes to the left of global variable '*.LC0' defined in '../src/gl/matrix.c' (0xb693fd60) of size 13
  '*.LC0' is ascii string 'glMatrixMode'
0xb693fd38 is located 0 bytes to the right of global variable 'StageExclusive' defined in '../src/gl/list.h:32:12' (0xb693fce0) of size 88
SUMMARY: AddressSanitizer: global-buffer-overflow ../src/gl/matrix.c:185 in gl4es_glMultMatrixf
Shadow bytes around the buggy address:
  0x36d27f50: f9 f9 f9 f9 05 f9 f9 f9 f9 f9 f9 f9 06 f9 f9 f9
  0x36d27f60: f9 f9 f9 f9 04 f9 f9 f9 f9 f9 f9 f9 00 05 f9 f9
  0x36d27f70: f9 f9 f9 f9 00 00 f9 f9 f9 f9 f9 f9 00 02 f9 f9
  0x36d27f80: f9 f9 f9 f9 00 00 00 00 00 00 00 00 00 00 00 00
  0x36d27f90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x36d27fa0: 00 00 00 00 00 00 00[f9]f9 f9 f9 f9 00 05 f9 f9
  0x36d27fb0: f9 f9 f9 f9 00 00 00 00 00 02 f9 f9 f9 f9 f9 f9
  0x36d27fc0: 00 06 f9 f9 f9 f9 f9 f9 00 00 00 00 00 03 f9 f9
  0x36d27fd0: f9 f9 f9 f9 00 07 f9 f9 f9 f9 f9 f9 00 00 00 00
  0x36d27fe0: 00 04 f9 f9 f9 f9 f9 f9 00 00 00 00 00 00 00 00
  0x36d27ff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==24446==ABORTING

I wasn't able to trigger any more complaints from libasan, great!

Problems with apitrace trace/replay in non-SDL apps

Trying to trace torcs using gl4es fails due to a probable bug in apitrace:

Program received signal SIGSEGV, Segmentation fault.
SnappyOutStream::write (this=0x48b80, buffer=0xbe800013, length=1) at /tmp/apitrace/lib/trace/trace_ostream_snappy.cpp:123
123     /tmp/apitrace/lib/trace/trace_ostream_snappy.cpp: No such file or directory.
(gdb) #0  SnappyOutStream::write (this=0x48b80, buffer=0xbe800013, length=1) at /tmp/apitrace/lib/trace/trace_ostream_snappy.cpp:123
#1  0xb6eb1ffc in trace::Writer::_write (this=<optimized out>, dwBytesToWrite=1, sBuffer=0xbe800013)
    at /tmp/apitrace/lib/trace/trace_writer.cpp:83
#2  trace::Writer::_writeByte (c=0 '\000', this=0xb6fd78a0 <trace::localWriter>) at /tmp/apitrace/lib/trace/trace_writer.cpp:88
#3  trace::Writer::beginEnter (this=this@entry=0xb6fd78a0 <trace::localWriter>, 
    sig=sig@entry=0xb6faa630 <_glXCreateContextAttribsARB_sig>, thread_id=0) at /tmp/apitrace/lib/trace/trace_writer.cpp:174
#4  0xb6eb3534 in trace::LocalWriter::beginEnter (this=this@entry=0xb6fd78a0 <trace::localWriter>, 
    sig=0xb6faa630 <_glXCreateContextAttribsARB_sig>, fake=fake@entry=false) at /tmp/apitrace/lib/trace/trace_writer_local.cpp:191
#5  0xb6e07540 in glXCreateContextAttribsARB (dpy=dpy@entry=0x47cd8, config=config@entry=0xb65adef8, 
    share_context=share_context@entry=0x0, direct=direct@entry=1, attrib_list=attrib_list@entry=0x0)
 at /tmp/apitrace/build/wrappers/glxtrace.cpp:16531
#6  0xb6e07750 in glXCreateContextAttribsARB (dpy=dpy@entry=0x47cd8, config=config@entry=0xb65adef8, 
    share_context=share_context@entry=0x0, direct=direct@entry=1, attrib_list=attrib_list@entry=0x0)
    at /tmp/apitrace/build/wrappers/glxtrace.cpp:16606
#7  0xb6e07750 in glXCreateContextAttribsARB (dpy=dpy@entry=0x47cd8, config=config@entry=0xb65adef8, 
    share_context=share_context@entry=0x0, direct=direct@entry=1, attrib_list=attrib_list@entry=0x0)
    at /tmp/apitrace/build/wrappers/glxtrace.cpp:16606
#8  0xb6e07750 in glXCreateContextAttribsARB (dpy=dpy@entry=0x47cd8, config=config@entry=0xb65adef8, 
    share_context=share_context@entry=0x0, direct=direct@entry=1, attrib_list=attrib_list@entry=0x0)
    at /tmp/apitrace/build/wrappers/glxtrace.cpp:16606
#9  0xb6e07750 in glXCreateContextAttribsARB (dpy=dpy@entry=0x47cd8, config=config@entry=0xb65adef8, 
    share_context=share_context@entry=0x0, direct=direct@entry=1, attrib_list=attrib_list@entry=0x0)
    at /tmp/apitrace/build/wrappers/glxtrace.cpp:16606
#10 0xb6e07750 in glXCreateContextAttribsARB (dpy=dpy@entry=0x47cd8, config=config@entry=0xb65adef8, 
    share_context=share_context@entry=0x0, direct=direct@entry=1, attrib_list=attrib_list@entry=0x0)
    at /tmp/apitrace/build/wrappers/glxtrace.cpp:16606
#11 0xb6e07750 in glXCreateContextAttribsARB (dpy=dpy@entry=0x47cd8, config=config@entry=0xb65adef8, 
    share_context=share_context@entry=0x0, direct=direct@entry=1, attrib_list=attrib_list@entry=0x0)
    at /tmp/apitrace/build/wrappers/glxtrace.cpp:16606
#12 0xb6e07750 in glXCreateContextAttribsARB (dpy=dpy@entry=0x47cd8, config=config@entry=0xb65adef8, 
    share_context=share_context@entry=0x0, direct=direct@entry=1, attrib_list=attrib_list@entry=0x0)
    at /tmp/apitrace/build/wrappers/glxtrace.cpp:16606
#13 0xb6e07750 in glXCreateContextAttribsARB (dpy=dpy@entry=0x47cd8, config=config@entry=0xb65adef8, 
    share_context=share_context@entry=0x0, direct=direct@entry=1, attrib_list=attrib_list@entry=0x0)
    at /tmp/apitrace/build/wrappers/glxtrace.cpp:16606
#14 0xb6e07750 in glXCreateContextAttribsARB (dpy=dpy@entry=0x47cd8, config=config@entry=0xb65adef8, 
    share_context=share_context@entry=0x0, direct=direct@entry=1, attrib_list=attrib_list@entry=0x0)
    at /tmp/apitrace/build/wrappers/glxtrace.cpp:16606

and so on. Posting here cause apitrace works fine under MESA.

Now, trying to replay a torcs MESA snapshot using gl4es also fails:

 LIBGL: Initialising gl4es
LIBGL: v0.9.2 built on Nov  9 2016 18:32:18
LIBGL:loaded: libGLESv1_CM.so
LIBGL:loaded: libEGL.so
LIBGL: Extension GL_OES_point_sprite detected and used
LIBGL: Extension GL_OES_point_size_array detected
LIBGL: Extension GL_OES_framebuffer_object detected and used
LIBGL: Extension GL_OES_packed_depth_stencil detected and used
LIBGL: Extension GL_OES_depth24 detected and used
LIBGL: Extension GL_OES_rgb8_rgba8 detected and used
LIBGL: Extension GL_EXT_texture_format_BGRA8888 detected
LIBGL: Extension GL_OES_depth_texture detected and used
LIBGL: Max texture size: 4096
LIBGL: Texture Units: 8, Max lights: 8
LIBGL: Implementation Read is GL_RGB/GL_UNSIGNED_SHORT_5_6_5
LIBGL: Current folder is:/home/odroid
glXQueryVersion(0x521900, 0xbef02e30, 0xbef02e34)
glXQuesryExtension(0x521900, 0x516008, 0x51600c)
glXQueryExtensionString(0x521900, 0)
glXChooseFBConfig(0x521900, 0, 0x57d670, 0xbef02d0c)
glXGetVisualFromFBConfig(0x521900, 0xb2ba7ef8)
glXCreateContextAttribsARB(0x521900, 0xb2ba7ef8, (nil), 1) config is RGBA:8888, depth=1, stencil=1, drawable=1
glXCreateWindow(0x521900, 0xb2ba7ef8, 25165826, (nil))
glXMakeCurrent(0x521900, 0x1800002, 0x57d6b8) 'isPBuffer(drawable)=0
LIBGL: ERROR: EGL Error detected: EGL_BAD_MATCH (0x3009)
error: failed to make current OpenGL context and drawable

Managed to build glshim for android

Then most of the undefined reference gl* errors went away when linking except for these:

error: undefined reference to 'glEnableVertexAttribArray'
error: undefined reference to 'glVertexAttribPointer'
error: undefined reference to 'glDisableVertexAttribArray'

GLES2: Double free when trying to run glmark2

I'm trying to run glmark2 on the ES2 backend of GL4ES. The ES2 driver is the one of Mesa.

When finish running the first test and switch to the second one, the following error shows:
*** Error in `glmark2': double free or corruption (fasttop): 0x0000564125337990 ***

Problems while compiling for Android

Hi

I am having some trouble compiling it on Android.
I am getting a few warnings, such as:
In file included from jni/glshim/src/gl/wrap/../gl.h:358:
jni/glshim/src/gl/stack.h:140:3: warning: redefinition of typedef 'glstack_t' is

  a C11 feature [-Wtypedef-redefinition]

} glstack_t;
^
jni/glshim/src/gl/state.h:11:27: note: previous definition is here
typedef struct _glstack_t glstack_t;
^
In file included from jni/glshim/src/gl/array.c:1:
In file included from jni/glshim/src/gl/array.h:1:
In file included from jni/glshim/src/gl/wrap/../gl.h:358:
jni/glshim/src/gl/stack.h:165:3: warning: redefinition of typedef
'glclientstack_t' is a C11 feature [-Wtypedef-redefinition]
} glclientstack_t;
^
jni/glshim/src/gl/state.h:12:33: note: previous definition is here
typedef struct _glclientstack_t glclientstack_t;

I am also getting an error:
^
jni/glshim/src/gl/array.c:211:9: error: invalid suffix 'd' on floating constant
GL_TYPE_SWITCH_MAX(out, dst, to,
^
jni/glshim/src/gl/wrap/../gl.h:180:64: note: expanded from macro
'GL_TYPE_SWITCH_MAX'
...GL_TYPE_CASE_MAX(name, var, GL_DOUBLE, GLdouble, code, 1.0d)
^
2 warnings and 1 error generated.
make: *** [obj/local/armeabi/objs/glshim/src/gl/array.o] Error 1

Any ideas?

IrrLicht engine

Hi ptitSeb ! :)

Sorry for bother you with another issue which very well maybe not related to gl4es itself, but while waiting for fixes in our drivers in amigaos4, i give a go and port IrrLicht engine as well over gl4es. So all compiles, links fine. But once i run some simple test case (which works of course via software rendering, etc), it crashes in the AmglGetIntergerv().

I.e. it should then come with GLSL checking, and have words "GLSL not available" (at least that i have on legacy opengl), or available (probably that it should be with gl4es ?). But instead it crashes:

4/0.Work:irrlicht/bin/> 01.HelloWorld_gl4es
LIBGL: Initialising gl4es
LIBGL: v1.0.5 built on Mar 2 2018 01:33:59
LIBGL: Using GLES 2.0 backend
LIBGL: OGLES2 Library and Interface open successfuly
LIBGL: Hardware test disabled, nothing activated...
init_matrix(0x6b0b1bb0)
LIBGL: Targeting OpenGL 2.0
LIBGL: Current folder is:/Work/irrlicht/bin/
Irrlicht Engine version 1.9.0
SDL initialized
SDL Version 1.2.15
Using renderer: OpenGL 2.0
GL4ES wrapper: ptitSeb
OpenGL driver version is 1.2 or better.
<< CRASH>>

I am almost sure, that its again some problems in our ogles2 driver (as i can see in log, that it crashes in the "AmiglGetIntegerv()", but maybe (only maybe), it can be something in gl4es as well ? Its even didn't throw any debug output from gl4es, as it crashes seems too early.

There is crashlog: http://kas1e.mikendezign.com/aos4/gl4es/irrlicht/crashlog_irrlicht_helloworld.txt

Maybe you have some ideas what it can be .. Thanks !

Strange stuck bug on the old Android devices

On older Android devices I get the problem with stuck when choosing some libraries through dlopen.

The bug is reproducible on Motorola Droid 2, Android 2.3.4 and don't affect on my another Android devices: Motorola Droid 4, Android 6.0.1 (CM 13), Motorola Photon Q, Android 4.1.2 and huge heap of emulators.

Using debug I found a place where the app gets stuck:

https://github.com/ptitSeb/gl4es/blob/master/src/gl/loader.c#L62

I put a couple of debug-output:

GL4ES Debug Output

And I got a log:

I/LIBGL: LIBGL: Initialising gl4es
I/LIBGL: LIBGL: v0.9.6 built on Jun  9 2017 08:03:25
I/LIBGL: Entering to this loops...
I/LIBGL: Trying to load: libbcm_host.so, flags: 0x00000000
<now app gets stuck w/ black screen>

I thought it was because of the RPi libraries that are not in the Android device and I commented this function calls:

BCM Wrong Libraries

But it did not help. OpenGL ES and EGL libraries were not loaded too:

I/LIBGL: LIBGL: Initialising gl4es
I/LIBGL: LIBGL: v0.9.6 built on Jun  9 2017 08:03:25
I/LIBGL: Entering to this loops...
I/LIBGL: Trying to load: libGLESv1_CM.so, flags: 0x00000000
<now app gets stuck w/ black screen>
I/LIBGL: LIBGL: Initialising gl4es
I/LIBGL: LIBGL: v0.9.6 built on Jun  9 2017 08:03:25
I/LIBGL: Entering to this loops...
I/LIBGL: Trying to load: libEGL.so, flags: 0x00000000
<now app gets stuck w/ black screen>

Log from the Motorola Photon Q, Android 4.1.2 phone, where everything works:

I/LIBGL: LIBGL: Initialising gl4es
I/LIBGL: LIBGL: v0.9.6 built on Jun  9 2017 08:03:25
I/LIBGL: Entering to this loops...
I/LIBGL: Trying to load: libGLESv1_CM.so, flags: 0x00000000
I/LIBGL: Now Here!
I/LIBGL: LIBGL:loaded: libGLESv1_CM.so
I/LIBGL: Entering to this loops...
I/LIBGL: Trying to load: libEGL.so, flags: 0x00000000
I/LIBGL: Now Here!
I/LIBGL: LIBGL:loaded: libEGL.so

I tried to substitute library name with the full path (e. g. /system/lib/egl/libEGL_POWERVR_SGX530_125.so) to the dlopen function, but this also does not work.

Any assumptions or suggestions? Thanks!

Spinning selector garbled in FO

I remember pointing out in a comment under one of the commits, the in-game system selector was not being animated in FreeOrion.

However, a year later and after compiling FO 0.4.6 + latest glshim, it seems it became animated
and looks like a garbled square. I'll try finding the comment that IIRC, linked to some C++ code.

fo

edit:
Here it is: 9d4dbc6#commitcomment-14491488

In stop-motion, in would probably look exactly like on the right.

GLX files cause issues with Android compilation

I'm trying to compile gl4es using ndk-build, but I'm getting the following error:

[armeabi] Compile thumb : GL <= glx.c
/home/user/git/android-port/deps/gl4es/src/glx/glx.c: In function 'gl4es_glXSwapInterval':
/home/user/git/android-port/deps/gl4es/src/glx/glx.c:1381:8: error: 'glxContext' undeclared (first use in this function)
if(glxContext) {
^
/home/user/git/android-port/deps/gl4es/src/glx/glx.c:1381:8: note: each undeclared identifier is reported only once for each function it appears in
make: *** [/home/user/git/android-port/deps/gl4es/obj/local/armeabi/objs/GL/src/glx/glx.o] Error 1

I've noticed the glxContext is defined toward the beginning of the file, but it's wrapped in an 'ifndef ANDROID' directive. The command I'm using to build is this:

$ANDROID_NDK/ndk-build
NDK_PROJECT_PATH=${BASEDIR}/gl4es
APP_BUILD_SCRIPT=${BASEDIR}/gl4es/Android.mk
APP_PLATFORM=android-21

Not compiling the source files from the src/glx folder works, but I don't want that to cause issues down the line.

lwjgl crash

Log:

org.lwjgl.opengl.OpenGLException: Invalid enum (1280)
at org.lwjgl.opengl.Util.checkGLError(Util.java:59)
at org.lwjgl.opengl.DrawableGL.checkGLError(DrawableGL.java:82)
at org.lwjgl.opengl.Display.swapBuffers(Display.java:605)
at org.lwjgl.opengl.Display.update(Display.java:634)
at org.lwjgl.opengl.Display.update(Display.java:616)
at bao.g(SourceFile:869)
at bbo.a(SourceFile:152)
at bbo.c(SourceFile:73)
at bao.a(SourceFile:1677)
at bao.a(SourceFile:1652)
at bjb.a(SourceFile:613)
at hs.a(SourceFile:32)
at hs.a(SourceFile:13)
at ej.a(SourceFile:174)
at bje.e(SourceFile:212)
at bao.p(SourceFile:1306)
at bao.ak(SourceFile:774)
at bao.f(SourceFile:728)
at net.minecraft.client.main.Main.main(SourceFile:148)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at net.zhuoweizhang.boardwalk.MainActivity.runCraft2(MainActivity.java:636)
at net.zhuoweizhang.boardwalk.MainActivity$3.onSurfaceCreated(MainActivity.java:213)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1494)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)

If i enable NOERROR error probability decreases. But it does not disappear at all.

More verbose Init error message needed

I'm trying to find out the state of egl/mali support on an S905 tv box running Ubuntu 16.04 and here's what I get from trying to run glxgears:

odroid@amlogic:~/gl4es$ glxgears
LIBGL: Initialising gl4es
LIBGL: v0.9.7 built on Jun 13 2017 20:22:17
LIBGL:loaded: libGLESv1_CM.so
LIBGL:loaded: libEGL.so
LIBGL: Error while gathering supported extension (Init issue), default to none 
LIBGL: Current folder is:/home/ odroid/gl4es 
LIBGL: Unable to create EGL display. 
Error: glXCreateContext failed

I'm not sure what the issue is about (hope I'm not mixing 32/64 bit code) so the error message could be more helpful.

Problems with Rockchip Chromebook

Hello,
I'm using an Asus C201 Chromebook which is built around the Rockchip RK3288 SoC (specs here which has the Mali T760 GPU. It's running Arch Linux ARM and according to the installation instructions, I have two packages installed: xf86-video-armsoc-rockchip which provides the X.org video driver and veyron-libgl which provides the Mali EGL and GLES drivers (version r5p0-3).

I recently opened an issue on the OpenRA repository about getting very poor performance with the game and asking if there was a way to make it use GLES rendering so that I can get hardware acceleration and someone pointed me to this project. So I compiled the libraries here by choosing the ODROID platform since that seemed to be closest to my specs (both have Mali GPU), ran the tests and got the logs here. The test finished successfully, but it didn't look like any of the samples ran smoothly (in fact, they ran just as they would without gl4es). Anyhow, something to note is the recurring error in the test log:

libGL error: unable to load driver: rockchip_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: rockchip

This is not specific to this test, I get this error everytime I run some software that uses OpenGL. I'm guessing it has to do with the fact that my GPU does not support OpenGL at all, so this is probably fine and doesn't have any effect on the test? I don't know. However, I still put lib/libGL.so.1 in LD_LIBRARY_PATH by running export LD_LIBRARY_PATH="$HOME/gl4es/lib/libGL.so.1:$LD_LIBRARY_PATH" from my terminal and running OpenRA afterwards:

$ openra-ra
Platform is Linux
Engine version is release-20171014
Using SDL 2 with OpenGL renderer
libGL error: unable to load driver: rockchip_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: rockchip
Desktop resolution: 1366x768
No custom resolution provided, using desktop resolution
Using resolution: 1366x768
Using window scale 1.00
OpenGL version: 3.0 Mesa 17.2.2
Using default sound device
shared memfd open() failed: Function not implemented
shared memfd open() failed: Function not implemented
Internal mods:
	cnc: Tiberian Dawn (release-20171014)
	d2k: Dune 2000 (release-20171014)
	modcontent: Mod Content Manager (release-20171014)
	ra: Red Alert (release-20171014)
External mods:
	ra-release-20171014: Red Alert (release-20171014)
Loading mod: ra
libpng warning: iCCP: known incorrect sRGB profile

I get the same libGL error saying it couldn't load my rockchip driver. The game still runs incredibly slow, with no performance difference compared to running without GL4ES. Please do tell me where I'm going wrong, or if GL4ES just isn't supported for my platform. I'm a total noob when it comes to this stuff.

Raspberry Pi Compilation issues...

There seems to be an issue with the GL recipe on Raspberry Pi.

Log:

pi@raspberrypi:~/glshim $ cmake . -DBCMHOST=1; make GL
-- The C compiler identification is GNU 4.9.2
-- The CXX compiler identification is GNU 4.9.2
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/pi/glshim
Scanning dependencies of target GL
[  3%] Building C object src/CMakeFiles/GL.dir/gl/debug.c.o
[  7%] Building C object src/CMakeFiles/GL.dir/gl/directstate.c.o
[ 10%] Building C object src/CMakeFiles/GL.dir/gl/render.c.o
[ 14%] Building C object src/CMakeFiles/GL.dir/gl/loader.c.o
[ 17%] Building C object src/CMakeFiles/GL.dir/gl/pixel.c.o
[ 21%] Building C object src/CMakeFiles/GL.dir/gl/stack.c.o
[ 25%] Building C object src/CMakeFiles/GL.dir/gl/list.c.o
[ 28%] Building C object src/CMakeFiles/GL.dir/gl/math/eval.c.o
[ 32%] Building C object src/CMakeFiles/GL.dir/gl/light.c.o
[ 35%] Building C object src/CMakeFiles/GL.dir/gl/raster.c.o
[ 39%] Building C object src/CMakeFiles/GL.dir/gl/line.c.o
[ 42%] Building C object src/CMakeFiles/GL.dir/gl/texgen.c.o
[ 46%] Building C object src/CMakeFiles/GL.dir/gl/framebuffers.c.o
[ 50%] Building C object src/CMakeFiles/GL.dir/gl/eval.c.o
[ 53%] Building C object src/CMakeFiles/GL.dir/gl/wrap/glstub.c.o
[ 57%] Building C object src/CMakeFiles/GL.dir/gl/wrap/glesext.c.o
[ 60%] Building C object src/CMakeFiles/GL.dir/gl/wrap/gles2.c.o
[ 64%] Building C object src/CMakeFiles/GL.dir/gl/wrap/gles.c.o
[ 67%] Building C object src/CMakeFiles/GL.dir/gl/wrap/gl.c.o
[ 71%] Building C object src/CMakeFiles/GL.dir/gl/texture.c.o
[ 75%] Building C object src/CMakeFiles/GL.dir/gl/decompress.c.o
[ 78%] Building C object src/CMakeFiles/GL.dir/gl/buffers.c.o
[ 82%] Building C object src/CMakeFiles/GL.dir/gl/array.c.o
[ 85%] Building C object src/CMakeFiles/GL.dir/gl/gl.c.o
[ 89%] Building C object src/CMakeFiles/GL.dir/glx/streaming.c.o
[ 92%] Building C object src/CMakeFiles/GL.dir/glx/lookup.c.o
In file included from /home/pi/glshim/src/glx/lookup.c:4:0:
/home/pi/glshim/src/glx/glx.h:5:22: fatal error: X11/Xlib.h: No such file or directory
 #include <X11/Xlib.h>
                      ^
compilation terminated.
src/CMakeFiles/GL.dir/build.make:629: recipe for target 'src/CMakeFiles/GL.dir/glx/lookup.c.o' failed
make[3]: *** [src/CMakeFiles/GL.dir/glx/lookup.c.o] Error 1
CMakeFiles/Makefile2:79: recipe for target 'src/CMakeFiles/GL.dir/all' failed
make[2]: *** [src/CMakeFiles/GL.dir/all] Error 2
CMakeFiles/Makefile2:91: recipe for target 'src/CMakeFiles/GL.dir/rule' failed
make[1]: *** [src/CMakeFiles/GL.dir/rule] Error 2
Makefile:110: recipe for target 'GL' failed
make: *** [GL] Error 2

Remote

Can you add glshim remote? I'd like to test it in virtual machine.

A few regressions still extant

Probably for a week now I've seen regressions:

  • Astromenace has been either slightly broken (borked textures) or, like currently, plain unusable (black screen, previous contents of video memory showing up)
  • torcs likewise in the texture department, but now fails to start with freeglut (/usr/local/lib/torcs/torcs-bin): Unable to create OpenGL 1.0 context (flags 0, profile 0)

Tried a few others too but couldn't find any problems so the breakage looks rather specific.

Runtime error: call to OpenGL ES API with no current context

I try to port PTAMM to android, whitch uses OpenGL API. When the application run, I got the following log information about LIBGL :

I/LIBGL: LIBGL:loaded: libGLESv1_CM.so
I/LIBGL: LIBGL:loaded: libEGL.so
E/libEGL: call to OpenGL ES API with no current context (logged once per thread)
E/libEGL: call to OpenGL ES API with no current context (logged once per thread)
D/libEGL: eglInitialize EGLDisplay = 0xff96769c
I/LIBGL: LIBGL: Extension GL_OES_blend_subtract detected and used
I/LIBGL: LIBGL: Extension GL_OES_blend_func_separate detected and used
I/LIBGL: LIBGL: Extension GL_OES_blend_equation_separate detected and used
I/LIBGL: LIBGL: Extension GL_EXT_blend_minmax detected and used
I/LIBGL: LIBGL: Extension GL_OES_point_sprite detected and used
I/LIBGL: LIBGL: Extension GL_OES_point_size_array detected
I/LIBGL: LIBGL: Extension GL_OES_element_index_uint detected
I/LIBGL: LIBGL: Extension GL_OES_framebuffer_object detected and used
I/LIBGL: LIBGL: Extension GL_OES_packed_depth_stencil detected and used
I/LIBGL: LIBGL: Extension GL_OES_depth24 detected and used
I/LIBGL: LIBGL: Extension GL_OES_rgb8_rgba8 detected and used
I/LIBGL: LIBGL: Extension GL_EXT_texture_format_BGRA8888 detected
I/LIBGL: LIBGL: Extension GL_OES_texture_cube_map detected and used
I/LIBGL: LIBGL: Max texture size: 16384
I/LIBGL: LIBGL: Texture Units: 8, Max lights: 8
I/LIBGL: LIBGL: Implementation Read is GL_RGBA/GL_UNSIGNED_BYTE
I/LIBGL: LIBGL: Current folder is:/

About the app, related native code :

void ARDriver::MakeFrameBuffer()
{
  // Needs nvidia drivers >= 97.46
  cout << "  ARDriver: Creating FBO... ";

  glGenTextures(1, &mnFrameBufferTex);
  glBindTexture(GL_TEXTURE_RECTANGLE_ARB,mnFrameBufferTex);
  glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0,
	       GL_RGBA, mirFBSize.x, mirFBSize.y, 0,
	       GL_RGBA, GL_UNSIGNED_BYTE, NULL);
  glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
  glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_NEAREST);

  GLuint DepthBuffer;
  glGenRenderbuffersEXT(1, &DepthBuffer);
  glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, DepthBuffer);
  glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT24, mirFBSize.x, mirFBSize.y);

  glGenFramebuffersEXT(1, &mnFrameBuffer);
  glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, mnFrameBuffer);
  glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
			    GL_TEXTURE_RECTANGLE_ARB, mnFrameBufferTex, 0);
  glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT,
  			       GL_RENDERBUFFER_EXT, DepthBuffer);

  CheckFramebufferStatus();
  cout << " .. created FBO." << endl;
  glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
}

static bool CheckFramebufferStatus()
{
  GLenum n;
  n = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
  if(n == GL_FRAMEBUFFER_COMPLETE_EXT)
    return true; // All good
  
  cout << "glCheckFrameBufferStatusExt returned an error." << endl;
  return false;
}

And the related log:

ARDriver: Creating FBO... glCheckFrameBufferStatusExt returned an error.
.. created FBO.

I don't know what is wrong. Error when LIBGL initializing ? Or the way I call OpenGL API ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.