WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: raylib on picore 14.1.0 without X  (Read 650 times)

Offline Chau

  • Newbie
  • *
  • Posts: 20
raylib on picore 14.1.0 without X
« on: March 25, 2024, 05:04:03 AM »
I am trying to setup my picore installation so I can compile raylib in native mode without using X. I am running on a RPI0W using picore 14.1.0.

I have:
  • At least loaded compiletc, libEGL-dev and libdrm-dev (and a few more)
  • Changed the include path in the raylib makefile to point to /usr/include/drm instead of /usr/include/libdrm
         Is it suppose to be /usr/include/libdrm or /usr/include/drm? I have a /usr/include/drm folder.

I compile by running
Code: [Select]
> make PLATFORM=PLATFORM_DRM
But it fails with this error:
Code: [Select]
platforms/rcore_drm.c: In functon 'InitPlatform':
platforms/rcore_drm.c: 972:67; error: 'EGL_OPENGL_ES3_BIT' undeclared (first use in this function); did you mean 'EGL_OPENGL_ES2_BUT'?
Does anyone have a clue to why it doesn't work and maybe what I am doing wrong?

Regards, Casper

Offline patrikg

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 679
Re: raylib on picore 14.1.0 without X
« Reply #1 on: March 25, 2024, 05:09:39 AM »
Take the easy route first, try to compile the raylib within the Raspberry Pi OS.
And then to picore, so you get a feeling what you are doing. and how that can be applied to picore.


Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11267
Re: raylib on picore 14.1.0 without X
« Reply #2 on: April 04, 2024, 06:50:13 AM »
Hi Chau
Which source code package are you using?
I downloaded the zip file from here:
https://github.com/raysan5/raylib

A search for  EGL_OPENGL_ES3_BIT  in that package turned up this:
Code: [Select]
tc@E310:~/Raylib/raylib-890058abcd6e3c03fe2c59ebb416db1e8b75446f$ grep -Rin "EGL_OPENGL_ES3_BIT" *
src/platforms/rcore_template.c:454:        EGL_RENDERABLE_TYPE, (rlGetVersion() == RL_OPENGL_ES_30)? EGL_OPENGL_ES3_BIT : EGL_OPENGL_ES2_BIT,      // Type of context support
src/platforms/rcore_drm.c:74:#ifndef EGL_OPENGL_ES3_BIT
src/platforms/rcore_drm.c:75:    #define EGL_OPENGL_ES3_BIT  0x40
src/platforms/rcore_drm.c:834:        EGL_RENDERABLE_TYPE, (rlGetVersion() == RL_OPENGL_ES_30)? EGL_OPENGL_ES3_BIT : EGL_OPENGL_ES2_BIT,      // Type of context support
src/platforms/rcore_android.c:819:        EGL_RENDERABLE_TYPE, (rlGetVersion() == RL_OPENGL_ES_30)? EGL_OPENGL_ES3_BIT : EGL_OPENGL_ES2_BIT,      // Type of context support
So lines 74 and 75 in rcore_drm.c ensure  EGL_OPENGL_ES3_BIT  is defined
before it is needed on line 834.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11267
Re: raylib on picore 14.1.0 without X
« Reply #3 on: April 04, 2024, 08:05:43 AM »
Hi Chau
One more thing,  rcore_drm.c  contains the line:
Code: [Select]
#include "EGL/egl.h"        // Native platform windowing system interface
If you look in  EGL/egl.h  you'll find it defines  EGL_OPENGL_ES3_BIT:
Code: [Select]
#ifndef EGL_VERSION_1_5
#define EGL_VERSION_1_5 1
typedef void *EGLSync;
typedef intptr_t EGLAttrib;
typedef khronos_utime_nanoseconds_t EGLTime;
typedef void *EGLImage;
#define EGL_CONTEXT_MAJOR_VERSION         0x3098
#define EGL_CONTEXT_MINOR_VERSION         0x30FB
#define EGL_CONTEXT_OPENGL_PROFILE_MASK   0x30FD
#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY 0x31BD
#define EGL_NO_RESET_NOTIFICATION         0x31BE
#define EGL_LOSE_CONTEXT_ON_RESET         0x31BF
#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT 0x00000001
#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT 0x00000002
#define EGL_CONTEXT_OPENGL_DEBUG          0x31B0
#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE 0x31B1
#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS  0x31B2
#define EGL_OPENGL_ES3_BIT                0x00000040
 ----- Snip -----
But it only does that if  EGL_VERSION_1_5  has not already
been defined somewhere else in the build process.

Offline patrikg

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 679
Re: raylib on picore 14.1.0 without X
« Reply #4 on: April 04, 2024, 08:08:22 AM »
Here some more instructions. You need some dev deps.

Code: [Select]
libdrm-dev libegl1-mesa-dev libgles2-mesa-dev libgbm-dev
https://github.com/raysan5/raylib/wiki/Working-on-Raspberry-Pi#compiling-raylib-source-code