PKG_CHECK_MODULES([EGL], [egl],
[have_egl=yes], [have_egl=no])
-PKG_CHECK_MODULES([OPENGL], [gl],
- [have_gl=yes], [have_gl=no])
-
-PKG_CHECK_MODULES([OPENGLES2], [glesv2],
+PKG_CHECK_MODULES([GLES2], [glesv2],
[have_gles2=yes], [have_gles2=no])
PKG_CHECK_MODULES([XKBCOMMON], [xkbcommon],
[enable uterm drm video backend])])
AC_MSG_RESULT([ok])
-AC_MSG_CHECKING([whether to provide OpenGL support])
-AC_ARG_ENABLE([opengl],
- [AS_HELP_STRING([--enable-opengl],
- [provide uterm opengl support])])
+AC_MSG_CHECKING([whether to provide OpenGLES2 support])
+AC_ARG_ENABLE([gles2],
+ [AS_HELP_STRING([--enable-gles2],
+ [provide uterm OpenGLES2 support])])
AC_MSG_RESULT([ok])
AC_MSG_CHECKING([whether to use xkbcommon keyboard backend])
dumb_enabled=no
drm_enabled=no
-gl_enabled=no
gles2_enabled=no
if test ! x$enable_drm = xno ; then
if test x$have_drm = xyes ; then
dumb_enabled=yes
fi
- if test ! x$enable_opengl = xno ; then
+ if test ! x$enable_gles2 = xno ; then
if test x$have_drm = xyes -a x$have_gbm = xyes -a x$have_egl = xyes ; then
- if test x$have_gl = xyes -o x$have_gles2 = xyes ; then
+ if test x$have_gles2 = xyes ; then
drm_enabled=yes
- if test x$have_gl = xyes ; then
- gl_enabled=yes
- fi
- if test x$have_gles2 = xyes ; then
- gles2_enabled=yes
- fi
+ gles2_enabled=yes
fi
fi
fi
AC_ERROR([drm library not found for uterm dumb drm backend])
fi
- if test x$enable_opengl = xyes -a x$drm_enabled = xno ; then
+ if test x$enable_gles2 = xyes -a x$drm_enabled = xno ; then
AC_ERROR([drm, gbm, egl, gl or gles2 libraries not found for uterm drm backend])
fi
fi
if test x$dumb_enabled = xyes ; then
AC_DEFINE([UTERM_HAVE_DUMB], [1],
- [Use uterm dubm drm video backend])
+ [Use uterm dumb drm video backend])
if test x$drm_enabled = xyes ; then
AC_DEFINE([UTERM_HAVE_DRM], [1],
DRM_LIBS=""
fi
-AM_CONDITIONAL([UTERM_HAVE_DUMB], [test x$dumb_enabled = xyes])
-AM_CONDITIONAL([UTERM_HAVE_DRM], [test x$drm_enabled = xyes])
-
-if test x$gl_enabled = xyes ; then
- AC_DEFINE([UTERM_HAVE_GL], [1],
- [Use OpenGL as drawing backend])
-else
- OPENGL_CFLAGS=""
- OPENGL_LIBS=""
-fi
-
if test x$gles2_enabled = xyes ; then
- AC_DEFINE([UTERM_HAVE_GLES2], [1],
+ AC_DEFINE([KMSCON_HAVE_GLES2], [1],
[Use OpenGLESv2 as drawing backend])
else
- OPENGLES2_CFLAGS=""
- OPENGLES2_LIBS=""
+ GLES2_CFLAGS=""
+ GLES2_LIBS=""
fi
+AM_CONDITIONAL([UTERM_HAVE_DUMB], [test x$dumb_enabled = xyes])
+AM_CONDITIONAL([UTERM_HAVE_DRM], [test x$drm_enabled = xyes])
+AM_CONDITIONAL([KMSCON_HAVE_GLES2], [test x$gles2_enabled = xyes])
+
#
# xkbcommon keyboard backend
# This checks for the xkbcommon library for keyboard handling in uterm. If it is
AC_SUBST(EGL_LIBS)
AC_SUBST(GBM_CFLAGS)
AC_SUBST(GBM_LIBS)
-AC_SUBST(OPENGLES2_CFLAGS)
-AC_SUBST(OPENGLES2_LIBS)
-AC_SUBST(OPENGL_CFLAGS)
-AC_SUBST(OPENGL_LIBS)
+AC_SUBST(GLES2_CFLAGS)
+AC_SUBST(GLES2_LIBS)
AC_SUBST(UDEV_CFLAGS)
AC_SUBST(UDEV_LIBS)
AC_SUBST(XKBCOMMON_CFLAGS)
fbdev: $fbdev_enabled
dumb drm: $dumb_enabled
drm: $drm_enabled
- opengl: $gl_enabled
- opengles2: $gles2_enabled
+ OpenGLES2: $gles2_enabled
Run "make" to start compilation process])
#include <stdlib.h>
#include "uterm.h"
-/* miscellaneous */
-void gl_clear_error();
-bool gl_has_error();
-void gl_viewport(struct uterm_screen *screen);
-void gl_clear_color(float r, float g, float b, float a);
-void gl_clear(void);
-
/*
* Math Helpers
* The gl_m4 type is a 4x4 matrix of floats. The gl_m4_stack is a stack of m4
float *gl_m4_stack_pop(struct gl_m4_stack *stack);
float *gl_m4_stack_tip(struct gl_m4_stack *stack);
+#ifdef KMSCON_HAVE_GLES2
+
+/* miscellaneous */
+void gl_clear_error();
+bool gl_has_error();
+void gl_viewport(struct uterm_screen *screen);
+void gl_clear_color(float r, float g, float b, float a);
+void gl_clear(void);
+
/*
* Texture API
* This allows to create new textures which can then be used to draw images with
const float *texcoords, size_t num,
unsigned int tex, const float *m);
+#else /* !KMSCON_HAVE_GLES2 */
+
+/* dummy helpers for the case that OpenGL is not available */
+
+static inline void gl_clear_error()
+{
+}
+
+static inline bool gl_has_error()
+{
+ return false;
+}
+
+static inline void gl_viewport(struct uterm_screen *screen)
+{
+}
+
+static inline void gl_clear_color(float r, float g, float b, float a)
+{
+}
+
+static inline void gl_clear(void)
+{
+}
+
+/*
+ * Texture API
+ * This allows to create new textures which can then be used to draw images with
+ * the shader API.
+ */
+
+static inline unsigned int gl_tex_new()
+{
+ return 1;
+}
+
+static inline void gl_tex_free(unsigned int tex)
+{
+}
+
+static inline void gl_tex_load(unsigned int tex, unsigned int width,
+ unsigned int stride,
+ unsigned int height, void *buf)
+{
+}
+
+/*
+ * Shader API
+ */
+
+struct gl_shader {
+ int unused;
+};
+
+static inline int gl_shader_new(struct gl_shader **out)
+{
+ *out = NULL;
+ return 0;
+}
+
+static inline void gl_shader_ref(struct gl_shader *shader)
+{
+}
+
+static inline void gl_shader_unref(struct gl_shader *shader)
+{
+}
+
+static inline void gl_shader_draw_def(struct gl_shader *shader,
+ float *vertices,
+ float *colors, size_t num)
+{
+}
+
+static inline void gl_shader_draw_tex(struct gl_shader *shader,
+ const float *vertices,
+ const float *texcoords, size_t num,
+ unsigned int tex, const float *m)
+{
+}
+
+#endif /* KMSCON_HAVE_GLES2 */
+
#endif /* GL_GL_H */