OpenGLES2 on RaspBerry Pi 1B
Posted: Tue Jan 15, 2019 8:15 pm
Hello,
I have developped an OpenGL ES program wich works perfectly on a Raspberry Pi 3, and I wanted to port it on a Pi 1.
The relevant part of the code is shown below. In the last line :
success = graphics_get_display_size(0, &state->screen_width, &state->screen_height);
success contains 0 after execution, and subsequent drawing command will fail.
Any idea what's wrong ???
I have developped an OpenGL ES program wich works perfectly on a Raspberry Pi 3, and I wanted to port it on a Pi 1.
The relevant part of the code is shown below. In the last line :
success = graphics_get_display_size(0, &state->screen_width, &state->screen_height);
success contains 0 after execution, and subsequent drawing command will fail.
Any idea what's wrong ???
Code: Select all
static const EGLint attribute_list[] =
{
EGL_RED_SIZE, 8,
EGL_GREEN_SIZE, 8,
EGL_BLUE_SIZE, 8,
EGL_ALPHA_SIZE, 8,
EGL_DEPTH_SIZE, 16,
EGL_SAMPLE_BUFFERS, 1,
EGL_SAMPLES, 4,
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
EGL_NONE
};
EGLConfig config;
// get an EGL display connection
state->display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
// initialize the EGL display connection
result = eglInitialize(state->display, nullptr, nullptr);
// get an appropriate EGL frame buffer configuration
result = eglChooseConfig(state->display, attribute_list, &config, 1, &num_config);
// create an EGL rendering context
const EGLint context_attrib_list[] = {
// request a context using Open GL ES 2.0
EGL_CONTEXT_CLIENT_VERSION, 2,
EGL_NONE
};
state->context = eglCreateContext(state->display, config, nullptr, context_attrib_list);
// create an EGL window surface
success = graphics_get_display_size(0, &state->screen_width, &state->screen_height);