opengles3-book
opengles3-book copied to clipboard
Code does not work on MESA
Fedora 20/21 the code cannot compile using cmake because it cannot find its own header files.
Meanwhile the standard instructions from the book to run cmake ../ from a new build directory:
[min@priara Hello_Triangle]$ pwd /home/min/Documents/code/opengles3-book/Chapter_2/Hello_Triangle [min@priara Hello_Triangle]$ mkdir build [min@priara Hello_Triangle]$ cd build [min@priara build]$ cmake .. -- The C compiler identification is GNU 4.9.1 -- The CXX compiler identification is GNU 4.9.1 -- 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/min/Documents/code/opengles3-book/Chapter_2/Hello_Triangle/build [min@priara build]$ make Scanning dependencies of target Hello_Triangle [100%] Building C object CMakeFiles/Hello_Triangle.dir/Hello_Triangle.c.o /home/min/Documents/code/opengles3-book/Chapter_2/Hello_Triangle/Hello_Triangle.c:38:20: fatal error: esUtil.h: No such file or directory #include "esUtil.h" ^ compilation terminated. CMakeFiles/Hello_Triangle.dir/build.make:54: recipe for target 'CMakeFiles/Hello_Triangle.dir/Hello_Triangle.c.o' failed make[2]: *** [CMakeFiles/Hello_Triangle.dir/Hello_Triangle.c.o] Error 1 CMakeFiles/Makefile2:60: recipe for target 'CMakeFiles/Hello_Triangle.dir/all' failed make[1]: *** [CMakeFiles/Hello_Triangle.dir/all] Error 2 Makefile:76: recipe for target 'all' failed make: *** [all] Error 2 [min@priara build]$
When attempting to compile the code using gcc by itself, I have managed to resolve all the symbols, but when run the program starts and exits without opening a window, displaying anything, or giving text in the form of an error message.
gcc -o Hello_Triangle Hello_Triangle.c -I../../Common/Include -lEGL -lGLESv2 -lX11 ../../Common/Source/esUtil.c ../../Common/Source/LinuxX11/esUtil_X11.c
This does compile, but does not appear to run properly.
OpenGL ES profile version string: OpenGL ES 3.0 Mesa 10.3.0-rc1 OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.0 OpenGL ES profile extensions: GL_ANGLE_texture_compression_dxt3, GL_ANGLE_texture_compression_dxt5, GL_APPLE_texture_max_level, GL_EXT_blend_minmax, GL_EXT_color_buffer_float, GL_EXT_discard_framebuffer, GL_EXT_map_buffer_range, GL_EXT_multi_draw_arrays, GL_EXT_read_format_bgra, GL_EXT_separate_shader_objects, GL_EXT_shader_integer_mix, GL_EXT_texture_compression_dxt1, GL_EXT_texture_filter_anisotropic, GL_EXT_texture_format_BGRA8888, GL_EXT_texture_rg, GL_EXT_texture_type_2_10_10_10_REV, GL_EXT_unpack_subimage, GL_NV_draw_buffers, GL_NV_fbo_color_attachments, GL_NV_read_buffer, GL_OES_EGL_image, GL_OES_EGL_image_external, GL_OES_compressed_ETC1_RGB8_texture, GL_OES_depth24, GL_OES_depth_texture, GL_OES_depth_texture_cube_map, GL_OES_element_index_uint, GL_OES_fbo_render_mipmap, GL_OES_get_program_binary, GL_OES_mapbuffer, GL_OES_packed_depth_stencil, GL_OES_rgb8_rgba8, GL_OES_standard_derivatives, GL_OES_stencil8, GL_OES_surfaceless_context, GL_OES_texture_3D, GL_OES_texture_npot, GL_OES_vertex_array_object
uname -a Linux priara.sonnet 3.16.1-301.fc21.x86_64 #1 SMP Mon Aug 25 13:06:39 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
building problem: i encountered the same problem on ubuntu 14.10 (which is unstable atm) if you try to build an example from an example folder you have "error: esUtil.h: No such file or directory" however, if you just build from root it builds OK: cd ../../ pwd [folder should be opengles3-book] cmake . make Chapter_2/Hello_Triangle/Hello_Triangle [should run the red triangle demo]
you have another problem with your graphics driver: eventually try to install proprietary drivers i also have problem with pvrshaman which does not detect opengl version correctly but as for the code examples from the book they work as expected here on two computers.
Building problem: confirmed, running cmake . and then make builds properly
No proprietary drivers have been installed or attempted on the computer I'm running this on, Intel-only on the other one and FOSS Radeon on this one.
I added some debug lines to Hello_Triangle and got this flow.
It enters esMain, then Init, goes into LoadShader twice, then back in Init it closes after glCreateProgram() returns 0.
https://www.khronos.org/opengles/sdk/docs/man/xhtml/glCreateProgram.xml
That call is supposed to return a non-zero number, so I added another debug line inside the check. printf("error: %s\n", glGetError()); error: (null)
Please tell me I'm doing something wrong with that call to glGetError, or something else that might help me fix that.
BTW, commenting the check for 0 from glCreateProgram() does open a window and enter draw. Nothing is actually drawn to the window (expected because of the other failure), but it does close and behave as a window is expected under X11.