libports: Mesa demos + adjust Qt5

* Adjust Qt5 to new Mesa version
* Added eglgears
* Adjust Mesa library build target

fixes #2488
This commit is contained in:
Sebastian Sumpf 2017-08-17 13:29:32 +02:00 committed by Christian Helmuth
parent 66db2ee54e
commit ff935ee1b0
22 changed files with 1210 additions and 52 deletions

View File

@ -17,6 +17,7 @@ set build_components {
server/nitpicker
server/fs_rom
server/wm
lib/mesa/swrast
app/pointer
app/floating_window_layouter
app/decorator
@ -203,6 +204,7 @@ append config {
<route>
<service name="Nitpicker"> <child name="wm"/> </service>
<service name="ROM" label="channel_list"> <child name="dynamic_rom" /> </service>
<service name="ROM" label="egl_drv.lib.so"> <parent label="egl_swrast.lib.so" /> </service>
<any-service> <parent/> <any-child/> </any-service>
</route>
</start>}
@ -241,12 +243,16 @@ set boot_modules {
qt5_widgets.lib.so
qt5_xml.lib.so
qt5_core.lib.so
egl.lib.so
egl_swrast.lib.so
expat.lib.so
freetype.lib.so
gallium.lib.so
glapi.lib.so
libc_pipe.lib.so
libm.lib.so
libpng.lib.so
jpeg.lib.so
mesa.lib.so
zlib.lib.so
stdcxx.lib.so
pthread.lib.so

View File

@ -9,7 +9,7 @@ include $(IMPORT_QT5_INC)
# included (in 'base/mk/lib.mk') by iterating through the elements of the
# 'LIBS' variable. Hence, we also need to manually import the stdcxx snippet.
#
LIBS += gallium
include $(call select_from_repositories,lib/import/import-gallium.mk)
LIBS += mesa
include $(call select_from_repositories,lib/import/import-mesa.mk)
QT5_INC_DIR += $(QT5_CONTRIB_DIR)/qtbase/include/QtGui

View File

@ -1,11 +1,14 @@
set build_components {
core init
drivers/timer
server/nitpicker server/nit_fb
app/launchpad app/pointer
app/eglgears
drivers/framebuffer drivers/input
lib/gallium
drivers/input
drivers/framebuffer
lib/mesa/swrast
server/nitpicker
server/nit_fb
app/launchpad
app/pointer
test/mesa_demo/eglgears
}
source ${genode_dir}/repos/base/run/platform_drv.inc
@ -16,25 +19,24 @@ build $build_components
create_boot_directory
set config {
<config>
<config prio_levels="2">
<parent-provides>
<service name="ROM"/>
<service name="CPU"/>
<service name="IRQ"/>
<service name="IO_MEM"/>
<service name="IO_PORT"/>
<service name="LOG"/>
<service name="PD"/>
<service name="RM"/>
<service name="CPU"/>
<service name="LOG"/>
<service name="ROM"/>
</parent-provides>
<default caps="100"/>
<default-route>
<any-service> <parent/> <any-child/> </any-service>
</default-route>
<default caps="100"/>
}
append_if [have_spec sdl] config {
append_if [have_spec linux] config {
<start name="fb_sdl" caps="200">
<resource name="RAM" quantum="4M"/>
<provides>
@ -45,16 +47,19 @@ append_if [have_spec sdl] config {
append_platform_drv_config
append_if [have_spec framebuffer] config {
<start name="fb_drv" caps="200">
<resource name="RAM" quantum="4M"/>
<provides><service name="Framebuffer"/></provides>
append_if [expr ![have_spec linux]] config {
<start name="fb_drv">
<resource name="RAM" quantum="10M"/>
<provides>
<service name="Framebuffer"/>
</provides>
<route><any-service> <parent /> <any-child/> </any-service> </route>
</start>}
append_if [have_spec ps2] config {
<start name="ps2_drv">
<resource name="RAM" quantum="1M"/>
<provides><service name="Input"/></provides>
<resource name="RAM" quantum="2M"/>
<provides> <service name="Input"/> </provides>
</start> }
append config {
@ -77,7 +82,7 @@ append config {
<resource name="RAM" quantum="1M"/>
</start>
<start name="launchpad" caps="400">
<resource name="RAM" quantum="1G"/>
<resource name="RAM" quantum="128M"/>
<config>
<launcher name="init" ram_quota="100M" caps="300">
<config>
@ -93,19 +98,25 @@ append config {
<service name="Platform"/>
<service name="Nitpicker"/>
<service name="Timer"/>
<service name="Drm" />
</parent-provides>
<default caps="100"/>
<start name="nit_fb">
<resource name="RAM" quantum="2M"/>
<provides><service name="Input"/><service name="Framebuffer"/></provides>
<route><any-service><parent/></any-service></route>
<config xpos="300" ypos="100" width="576" height="408" />
<config xpos="300" ypos="100" width="600" height="600" />
</start>
<start name="eglgears">
<start name="gears" caps="128">
<resource name="RAM" quantum="1G"/>
<route><any-service> <parent /> <any-child/> </any-service></route>
<route>
<service name="ROM" label="egl_drv.lib.so"> <parent label="egl_swrast.lib.so" /> </service>
<any-service> <parent /> <any-child/> </any-service>
</route>
<config>
<vfs> <dir name="dev"> <log/> </dir> </vfs>
<vfs>
<dir name="dev"> <log/> </dir>
</vfs>
<libc stdout="/dev/log"/>
</config>
</start>
@ -120,14 +131,16 @@ install_config $config
set boot_modules {
core init ld.lib.so timer nitpicker nit_fb
launchpad eglgears pointer
gallium.lib.so libc.lib.so libm.lib.so pthread.lib.so posix.lib.so
launchpad gears pointer
libc.lib.so libm.lib.so pthread.lib.so
egl.lib.so mesa.lib.so stdcxx.lib.so
expat.lib.so glapi.lib.so
egl_swrast.lib.so
}
lappend_if [have_spec linux] boot_modules fb_sdl
lappend_if [have_spec framebuffer] boot_modules fb_drv
lappend_if [have_spec ps2] boot_modules ps2_drv
lappend_if [have_spec i915] boot_modules gallium-i915.lib.so
lappend_if [have_spec linux] boot_modules fb_sdl
lappend_if [expr ![have_spec linux]] boot_modules fb_drv
lappend_if [have_spec ps2] boot_modules ps2_drv
append_platform_drv_boot_modules

View File

@ -7,6 +7,7 @@ source ${genode_dir}/repos/libports/run/qt5_common.inc
append build_components [qt5_build_components feature]
append build_components {
lib/mesa/swrast
app/qt5/qt_launchpad
app/qt5/examples/calculatorform
app/qt5/examples/tetrix
@ -36,7 +37,7 @@ append config {
</parent-provides>
<default caps="100"/>
<default-route>
<any-service> <parent/> <child name="wm"/> <any-child/> </any-service>
<any-service> <parent/> <any-child/> </any-service>
</default-route>}
append config [qt5_start_nodes feature]
@ -69,6 +70,11 @@ append config {
</config>
</launcher>
</config>
<route>
<service name="Nitpicker"> <child name="wm"/> </service>
<service name="ROM" label="egl_drv.lib.so"> <parent label="egl_swrast.lib.so" /> </service>
<any-service> <parent /> <any-child/> </any-service>
</route>
</start>
</config>
}
@ -83,14 +89,18 @@ append boot_modules [qt5_boot_modules feature]
append boot_modules {
qt_launchpad
egl.lib.so
egl_swrast.lib.so
expat.lib.so
freetype.lib.so
gallium.lib.so
glapi.lib.so
ld.lib.so
libc.lib.so
libc_pipe.lib.so
libm.lib.so
libpng.lib.so
jpeg.lib.so
mesa.lib.so
pcre16.lib.so
pthread.lib.so
qt5_component.lib.so

View File

@ -9,6 +9,7 @@ set feature(Audio_out) 1
append build_components [qt5_build_components feature]
append build_components {
lib/mesa/swrast
app/avplay
app/qt5/qt_avplay
}
@ -45,7 +46,7 @@ append config {
</parent-provides>
<default caps="100"/>
<default-route>
<any-service> <parent/> <child name="wm"/> <any-child/> </any-service>
<any-service> <parent/> <any-child/> </any-service>
</default-route>}
append config [qt5_start_nodes feature]
@ -61,6 +62,11 @@ append config {
<libc stdout="/dev/log" stderr="/dev/log"/>
<mediafile name="mediafile"/>
</config>
<route>
<service name="Nitpicker"> <child name="wm"/> </service>
<service name="ROM" label="egl_drv.lib.so"> <parent label="egl_swrast.lib.so" /> </service>
<any-service> <parent /> <any-child/> </any-service>
</route>
</start>
</config>
}
@ -75,10 +81,14 @@ append boot_modules [qt5_boot_modules feature]
append boot_modules {
qt_avplay
egl.lib.so
egl_swrast.lib.so
expat.lib.so
freetype.lib.so
gallium.lib.so
glapi.lib.so
ld.lib.so
libc.lib.so
mesa.lib.so
posix.lib.so
libc_pipe.lib.so
libm.lib.so

View File

@ -7,6 +7,7 @@ source ${genode_dir}/repos/libports/run/qt5_common.inc
append build_components [qt5_build_components feature]
append build_components {
lib/mesa/swrast
app/qt5/examples/calculatorform
}
@ -33,7 +34,7 @@ append config {
</parent-provides>
<default caps="100"/>
<default-route>
<any-service> <parent/> <child name="wm"/> <any-child/> </any-service>
<any-service> <parent/> <any-child/> </any-service>
</default-route>}
append config [qt5_start_nodes feature]
@ -48,6 +49,11 @@ append config {
</vfs>
<libc stdout="/dev/log" stderr="/dev/log"/>
</config>
<route>
<service name="Nitpicker"> <child name="wm"/> </service>
<service name="ROM" label="egl_drv.lib.so"> <parent label="egl_swrast.lib.so" /> </service>
<any-service> <parent /> <any-child/> </any-service>
</route>
</start>
</config>
}
@ -62,14 +68,18 @@ append boot_modules [qt5_boot_modules feature]
append boot_modules {
calculatorform
egl.lib.so
egl_swrast.lib.so
expat.lib.so
freetype.lib.so
gallium.lib.so
glapi.lib.so
ld.lib.so
libc.lib.so
libc_pipe.lib.so
libm.lib.so
libpng.lib.so
jpeg.lib.so
mesa.lib.so
pcre16.lib.so
pthread.lib.so
qt5_component.lib.so

View File

@ -7,6 +7,7 @@ source ${genode_dir}/repos/libports/run/qt5_common.inc
append build_components [qt5_build_components feature]
append build_components {
lib/mesa/swrast
app/qt5/examples/openglwindow
}
@ -40,6 +41,10 @@ append config [qt5_start_nodes feature]
append config {
<start name="openglwindow" caps="200">
<resource name="RAM" quantum="80M"/>
<route>
<service name="ROM" label="egl_drv.lib.so"> <parent label="egl_swrast.lib.so" /> </service>
<any-service> <parent /> <child name="wm" /> <any-child/> </any-service>
</route>
<config>
<vfs>
<dir name="dev"> <log/> </dir>
@ -61,14 +66,18 @@ append boot_modules [qt5_boot_modules feature]
append boot_modules {
openglwindow
expat.lib.so
freetype.lib.so
gallium.lib.so
ld.lib.so
libc.lib.so
libc_pipe.lib.so
libm.lib.so
libpng.lib.so
jpeg.lib.so
mesa.lib.so
egl.lib.so
egl_swrast.lib.so
glapi.lib.so
pcre16.lib.so
pthread.lib.so
qt5_component.lib.so

View File

@ -7,6 +7,7 @@ source ${genode_dir}/repos/libports/run/qt5_common.inc
append build_components [qt5_build_components feature]
append build_components {
lib/mesa/swrast
server/loader
server/tar_rom
test/nitpicker
@ -35,7 +36,7 @@ append config {
</parent-provides>
<default caps="100"/>
<default-route>
<any-service> <parent/> <child name="wm"/> <any-child/> </any-service>
<any-service> <parent/> <any-child/> </any-service>
</default-route>}
append config [qt5_start_nodes feature]
@ -52,6 +53,10 @@ append config {
<parent-rom name="testnit"/>
</policy>
</config>
<route>
<service name="Nitpicker"> <child name="wm"/> </service>
<any-service> <parent /> <any-child/> </any-service>
</route>
</start>
<start name="test-qpluginwidget" caps="900">
<resource name="RAM" quantum="30M"/>
@ -62,6 +67,11 @@ append config {
</vfs>
<libc stdout="/dev/log" stderr="/dev/log"/>
</config>
<route>
<service name="Nitpicker"> <child name="wm"/> </service>
<service name="ROM" label="egl_drv.lib.so"> <parent label="egl_swrast.lib.so" /> </service>
<any-service> <parent /> <any-child/> </any-service>
</route>
</start>
</config>
}
@ -81,8 +91,11 @@ append boot_modules {
tar_rom
testnit
test-qpluginwidget
egl.lib.so
egl_swrast.lib.so
expat.lib.so
freetype.lib.so
gallium.lib.so
glapi.lib.so
ld.lib.so
libc.lib.so
libc_pipe.lib.so
@ -91,6 +104,7 @@ append boot_modules {
libpng.lib.so
libssl.lib.so
jpeg.lib.so
mesa.lib.so
pcre16.lib.so
pthread.lib.so
qt5_component.lib.so

View File

@ -7,6 +7,7 @@ source ${genode_dir}/repos/libports/run/qt5_common.inc
append build_components [qt5_build_components feature]
append build_components {
lib/mesa/swrast
app/qt5/qt_quicktest
lib/qt5/qtdeclarative/src/imports/qtquick2
}
@ -33,7 +34,7 @@ append config {
</parent-provides>
<default caps="100"/>
<default-route>
<any-service> <parent/> <child name="wm"/> <any-child/> </any-service>
<any-service> <parent/> <any-child/> </any-service>
</default-route>}
append config [qt5_start_nodes feature]
@ -48,6 +49,11 @@ append config {
</vfs>
<libc stdout="/dev/log" stderr="/dev/log"/>
</config>
<route>
<service name="Nitpicker"> <child name="wm"/> </service>
<service name="ROM" label="egl_drv.lib.so"> <parent label="egl_swrast.lib.so" /> </service>
<any-service> <parent /> <any-child/> </any-service>
</route>
</start>
</config>
}
@ -65,8 +71,11 @@ append boot_modules [qt5_boot_modules feature]
append boot_modules {
qt_quicktest
egl.lib.so
egl_swrast.lib.so
expat.lib.so
freetype.lib.so
gallium.lib.so
glapi.lib.so
ld.lib.so
libc.lib.so
libc_pipe.lib.so
@ -75,6 +84,7 @@ append boot_modules {
libpng.lib.so
libssl.lib.so
jpeg.lib.so
mesa.lib.so
pcre16.lib.so
pthread.lib.so
qt5_component.lib.so

View File

@ -7,6 +7,7 @@ source ${genode_dir}/repos/libports/run/qt5_common.inc
append build_components [qt5_build_components feature]
append build_components {
lib/mesa/swrast
app/qt5/examples/samegame
lib/qt5/qtdeclarative/src/imports/qtquick2
}
@ -33,7 +34,7 @@ append config {
</parent-provides>
<default caps="100"/>
<default-route>
<any-service> <parent/> <child name="wm"/> <any-child/> </any-service>
<any-service> <parent/> <any-child/> </any-service>
</default-route>}
append config [qt5_start_nodes feature]
@ -48,6 +49,11 @@ append config {
</vfs>
<libc stdout="/dev/log" stderr="/dev/log"/>
</config>
<route>
<service name="Nitpicker"> <child name="wm"/> </service>
<service name="ROM" label="egl_drv.lib.so"> <parent label="egl_swrast.lib.so" /> </service>
<any-service> <parent /> <any-child/> </any-service>
</route>
</start>
</config>
}
@ -65,8 +71,11 @@ append boot_modules [qt5_boot_modules feature]
append boot_modules {
samegame
egl.lib.so
egl_swrast.lib.so
expat.lib.so
freetype.lib.so
gallium.lib.so
glapi.lib.so
ld.lib.so
libc.lib.so
libc_pipe.lib.so
@ -75,6 +84,7 @@ append boot_modules {
libpng.lib.so
libssl.lib.so
jpeg.lib.so
mesa.lib.so
pcre16.lib.so
pthread.lib.so
qt5_component.lib.so

View File

@ -7,6 +7,7 @@ source ${genode_dir}/repos/libports/run/qt5_common.inc
append build_components [qt5_build_components feature]
append build_components {
lib/mesa/swrast
app/qt5/examples/tetrix
}
@ -32,7 +33,7 @@ append config {
</parent-provides>
<default caps="100"/>
<default-route>
<any-service> <parent/> <child name="wm"/> <any-child/> </any-service>
<any-service> <parent/> <any-child/> </any-service>
</default-route>}
append config [qt5_start_nodes feature]
@ -47,6 +48,11 @@ append config {
</vfs>
<libc stdout="/dev/log" stderr="/dev/log"/>
</config>
<route>
<service name="Nitpicker"> <child name="wm"/> </service>
<service name="ROM" label="egl_drv.lib.so"> <parent label="egl_swrast.lib.so" /> </service>
<any-service> <parent /> <any-child/> </any-service>
</route>
</start>
</config>
}
@ -61,14 +67,18 @@ append boot_modules [qt5_boot_modules feature]
append boot_modules {
tetrix
egl.lib.so
egl_swrast.lib.so
expat.lib.so
freetype.lib.so
gallium.lib.so
glapi.lib.so
ld.lib.so
libc.lib.so
libc_pipe.lib.so
libm.lib.so
libpng.lib.so
jpeg.lib.so
mesa.lib.so
pcre16.lib.so
pthread.lib.so
qt5_component.lib.so

View File

@ -12,6 +12,7 @@ if {[have_spec odroid_xu]} {
append build_components [qt5_build_components feature]
append build_components {
lib/mesa/swrast
app/qt5/examples/textedit
}
@ -45,7 +46,7 @@ append config {
</parent-provides>
<default caps="100"/>
<default-route>
<any-service> <parent/> <child name="wm"/> <any-child/> </any-service>
<any-service> <parent/> <any-child/> </any-service>
</default-route>}
append config [qt5_start_nodes feature]
@ -97,6 +98,11 @@ append config {
<dir name="fs"> <fs/> </dir>
</vfs>
</config>
<route>
<service name="Nitpicker"> <child name="wm"/> </service>
<service name="ROM" label="egl_drv.lib.so"> <parent label="egl_swrast.lib.so" /> </service>
<any-service> <parent /> <any-child/> </any-service>
</route>
</start>
<start name="textedit2" caps="250">
<binary name="textedit" />
@ -109,6 +115,11 @@ append config {
<dir name="fs"> <fs/> </dir>
</vfs>
</config>
<route>
<service name="Nitpicker"> <child name="wm"/> </service>
<service name="ROM" label="egl_drv.lib.so"> <parent label="egl_swrast.lib.so" /> </service>
<any-service> <parent /> <any-child/> </any-service>
</route>
</start>
</config>
}
@ -123,14 +134,18 @@ append boot_modules [qt5_boot_modules feature]
append boot_modules {
textedit
egl.lib.so
egl_swrast.lib.so
expat.lib.so
freetype.lib.so
gallium.lib.so
glapi.lib.so
ld.lib.so
libc.lib.so
libc_pipe.lib.so
libm.lib.so
libpng.lib.so
jpeg.lib.so
mesa.lib.so
pcre16.lib.so
pthread.lib.so
qt5_component.lib.so

View File

@ -86,7 +86,7 @@ bool QNitpickerGLContext::makeCurrent(QPlatformSurface *surface)
qFatal("eglDestroySurface() failed");
EGLSurface egl_surface =
eglCreateWindowSurface(_egl_display, _egl_config, &egl_window, 0);
eglCreatePixmapSurface(_egl_display, _egl_config, &egl_window, 0);
if (egl_surface == EGL_NO_SURFACE)
qFatal("eglCreateiWindowSurface() failed");

View File

@ -1,6 +1,5 @@
TARGET = test-mesa
LIBS = libc mesa mesa-egl
LIBS += $(addprefix gallium-,aux softpipe failover identity egl)
LIBS = libc mesa egl
SRC_CC = main.cc
vpath main.cc $(PRG_DIR)/..

View File

@ -0,0 +1,302 @@
/*
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*
* This is a port of the infamous "glxgears" demo to straight EGL
* Port by Dane Rushton 10 July 2005
*
* No command line options.
* Program runs for 5 seconds then exits, outputing framerate to console
*/
#include <math.h>
#include "gl_wrap.h"
#include <EGL/egl.h>
#include <stdio.h>
#include "eglut.h"
static GLfloat view_rotx = 20.0, view_roty = 30.0, view_rotz = 0.0;
static GLint gear1, gear2, gear3;
static GLfloat angle = 0.0;
/*
*
* Draw a gear wheel. You'll probably want to call this function when
* building a display list since we do a lot of trig here.
*
* Input: inner_radius - radius of hole at center
* outer_radius - radius at center of teeth
* width - width of gear
* teeth - number of teeth
* tooth_depth - depth of tooth
*/
static void
gear(GLfloat inner_radius, GLfloat outer_radius, GLfloat width,
GLint teeth, GLfloat tooth_depth)
{
GLint i;
GLfloat r0, r1, r2;
GLfloat angle, da;
GLfloat u, v, len;
r0 = inner_radius;
r1 = outer_radius - tooth_depth / 2.0;
r2 = outer_radius + tooth_depth / 2.0;
da = 2.0 * M_PI / teeth / 4.0;
glShadeModel(GL_FLAT);
glNormal3f(0.0, 0.0, 1.0);
/* draw front face */
glBegin(GL_QUAD_STRIP);
for (i = 0; i <= teeth; i++) {
angle = i * 2.0 * M_PI / teeth;
glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
if (i < teeth) {
glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
width * 0.5);
}
}
glEnd();
/* draw front sides of teeth */
glBegin(GL_QUADS);
da = 2.0 * M_PI / teeth / 4.0;
for (i = 0; i < teeth; i++) {
angle = i * 2.0 * M_PI / teeth;
glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5);
glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da),
width * 0.5);
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
width * 0.5);
}
glEnd();
glNormal3f(0.0, 0.0, -1.0);
/* draw back face */
glBegin(GL_QUAD_STRIP);
for (i = 0; i <= teeth; i++) {
angle = i * 2.0 * M_PI / teeth;
glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
if (i < teeth) {
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
-width * 0.5);
glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
}
}
glEnd();
/* draw back sides of teeth */
glBegin(GL_QUADS);
da = 2.0 * M_PI / teeth / 4.0;
for (i = 0; i < teeth; i++) {
angle = i * 2.0 * M_PI / teeth;
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
-width * 0.5);
glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da),
-width * 0.5);
glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5);
glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
}
glEnd();
/* draw outward faces of teeth */
glBegin(GL_QUAD_STRIP);
for (i = 0; i < teeth; i++) {
angle = i * 2.0 * M_PI / teeth;
glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
u = r2 * cos(angle + da) - r1 * cos(angle);
v = r2 * sin(angle + da) - r1 * sin(angle);
len = sqrt(u * u + v * v);
u /= len;
v /= len;
glNormal3f(v, -u, 0.0);
glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5);
glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5);
glNormal3f(cos(angle), sin(angle), 0.0);
glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da),
width * 0.5);
glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da),
-width * 0.5);
u = r1 * cos(angle + 3 * da) - r2 * cos(angle + 2 * da);
v = r1 * sin(angle + 3 * da) - r2 * sin(angle + 2 * da);
glNormal3f(v, -u, 0.0);
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
width * 0.5);
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
-width * 0.5);
glNormal3f(cos(angle), sin(angle), 0.0);
}
glVertex3f(r1 * cos(0), r1 * sin(0), width * 0.5);
glVertex3f(r1 * cos(0), r1 * sin(0), -width * 0.5);
glEnd();
glShadeModel(GL_SMOOTH);
/* draw inside radius cylinder */
glBegin(GL_QUAD_STRIP);
for (i = 0; i <= teeth; i++) {
angle = i * 2.0 * M_PI / teeth;
glNormal3f(-cos(angle), -sin(angle), 0.0);
glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
}
glEnd();
}
static void
draw(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
#if 1
glPushMatrix();
glRotatef(view_rotx, 1.0, 0.0, 0.0);
glRotatef(view_roty, 0.0, 1.0, 0.0);
glRotatef(view_rotz, 0.0, 0.0, 1.0);
glPushMatrix();
glTranslatef(-3.0, -2.0, 0.0);
glRotatef(angle, 0.0, 0.0, 1.0);
glCallList(gear1);
glPopMatrix();
glPushMatrix();
glTranslatef(3.1, -2.0, 0.0);
glRotatef(-2.0 * angle - 9.0, 0.0, 0.0, 1.0);
glCallList(gear2);
glPopMatrix();
glPushMatrix();
glTranslatef(-3.1, 4.2, 0.0);
glRotatef(-2.0 * angle - 25.0, 0.0, 0.0, 1.0);
glCallList(gear3);
glPopMatrix();
glPopMatrix();
#endif
}
static void
idle(void)
{
static double t0 = -1.;
double dt, t = eglutGet(EGLUT_ELAPSED_TIME) / 1000.0;
if (t0 < 0.0)
t0 = t;
dt = t - t0;
t0 = t;
angle += 70.0 * dt; /* 70 degrees per second */
angle = fmod(angle, 360.0); /* prevents eventual overflow */
eglutPostRedisplay();
}
/* new window size or exposure */
static void
reshape(int width, int height)
{
GLfloat h = (GLfloat) height / (GLfloat) width;
glViewport(0, 0, (GLint) width, (GLint) height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-1.0, 1.0, -h, h, 5.0, 60.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0, 0.0, -40.0);
}
static void
init(void)
{
static GLfloat pos[4] = { 5.0, 5.0, 10.0, 0.0 };
static GLfloat red[4] = { 0.8, 0.1, 0.0, 1.0 };
static GLfloat green[4] = { 0.0, 0.8, 0.2, 1.0 };
static GLfloat blue[4] = { 0.2, 0.2, 1.0, 1.0 };
glLightfv(GL_LIGHT0, GL_POSITION, pos);
glEnable(GL_CULL_FACE);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glEnable(GL_DEPTH_TEST);
/* make the gears */
gear1 = glGenLists(1);
glNewList(gear1, GL_COMPILE);
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red);
gear(1.0, 4.0, 1.0, 20, 0.7);
glEndList();
gear2 = glGenLists(1);
glNewList(gear2, GL_COMPILE);
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green);
gear(0.5, 2.0, 2.0, 10, 0.7);
glEndList();
gear3 = glGenLists(1);
glNewList(gear3, GL_COMPILE);
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue);
gear(1.3, 2.0, 0.5, 10, 0.7);
glEndList();
glEnable(GL_NORMALIZE);
}
int
eglut_main(int argc, char *argv[])
{
eglutInitWindowSize(600, 600);
eglutInitAPIMask(EGLUT_OPENGL_BIT);
eglutInit(argc, argv);
eglutCreateWindow("eglgears");
eglutIdleFunc(idle);
eglutReshapeFunc(reshape);
eglutDisplayFunc(draw);
init();
glDrawBuffer(GL_BACK);
eglutMainLoop();
return 0;
}

View File

@ -0,0 +1,12 @@
TARGET = gears
LIBS = libm libc egl mesa
SRC_C = eglgears.c eglut.c
SRC_CC = eglut_genode.cc
LD_OPT = --export-dynamic
INC_DIR += $(REP_DIR)/src/lib/mesa/include \
$(PRG_DIR)/../eglut
vpath %.c $(PRG_DIR)/../eglut
vpath %.cc $(PRG_DIR)/../eglut

View File

@ -0,0 +1,368 @@
/*
* Copyright (C) 2010 LunarG Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Authors:
* Chia-I Wu <olv@lunarg.com>
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <sys/time.h>
#include "EGL/egl.h"
#include "EGL/eglext.h"
#include "eglutint.h"
static struct eglut_state _eglut_state = {
.api_mask = EGLUT_OPENGL_ES1_BIT,
.window_width = 300,
.window_height = 300,
.verbose = 0,
.num_windows = 0,
};
struct eglut_state *_eglut = &_eglut_state;
void
_eglutFatal(char *format, ...)
{
va_list args;
va_start(args, format);
fprintf(stderr, "EGLUT: ");
vfprintf(stderr, format, args);
va_end(args);
exit(1);
}
/* return current time (in milliseconds) */
int
_eglutNow(void)
{
struct timeval tv;
#ifdef __VMS
(void) gettimeofday(&tv, NULL );
#else
struct timezone tz;
(void) gettimeofday(&tv, &tz);
#endif
return tv.tv_sec * 1000 + tv.tv_usec / 1000;
}
static void
_eglutDestroyWindow(struct eglut_window *win)
{
if (_eglut->surface_type != EGL_PBUFFER_BIT)
eglDestroySurface(_eglut->dpy, win->surface);
_eglutNativeFiniWindow(win);
eglDestroyContext(_eglut->dpy, win->context);
}
static EGLConfig
_eglutChooseConfig(void)
{
EGLConfig config;
EGLint config_attribs[32];
EGLint renderable_type, num_configs, i;
i = 0;
config_attribs[i++] = EGL_RED_SIZE;
config_attribs[i++] = 1;
config_attribs[i++] = EGL_GREEN_SIZE;
config_attribs[i++] = 1;
config_attribs[i++] = EGL_BLUE_SIZE;
config_attribs[i++] = 1;
config_attribs[i++] = EGL_DEPTH_SIZE;
config_attribs[i++] = 1;
config_attribs[i++] = EGL_SURFACE_TYPE;
config_attribs[i++] = _eglut->surface_type;
config_attribs[i++] = EGL_RENDERABLE_TYPE;
renderable_type = 0x0;
if (_eglut->api_mask & EGLUT_OPENGL_BIT)
renderable_type |= EGL_OPENGL_BIT;
if (_eglut->api_mask & EGLUT_OPENGL_ES1_BIT)
renderable_type |= EGL_OPENGL_ES_BIT;
if (_eglut->api_mask & EGLUT_OPENGL_ES2_BIT)
renderable_type |= EGL_OPENGL_ES2_BIT;
if (_eglut->api_mask & EGLUT_OPENVG_BIT)
renderable_type |= EGL_OPENVG_BIT;
config_attribs[i++] = renderable_type;
config_attribs[i] = EGL_NONE;
if (!eglChooseConfig(_eglut->dpy,
config_attribs, &config, 1, &num_configs) || !num_configs)
_eglutFatal("failed to choose a config");
return config;
}
static struct eglut_window *
_eglutCreateWindow(const char *title, int x, int y, int w, int h)
{
struct eglut_window *win;
EGLint context_attribs[4];
EGLint api, i;
win = calloc(1, sizeof(*win));
if (!win)
_eglutFatal("failed to allocate window");
win->config = _eglutChooseConfig();
i = 0;
context_attribs[i] = EGL_NONE;
/* multiple APIs? */
api = EGL_OPENGL_ES_API;
if (_eglut->api_mask & EGLUT_OPENGL_BIT) {
api = EGL_OPENGL_API;
}
else if (_eglut->api_mask & EGLUT_OPENVG_BIT) {
api = EGL_OPENVG_API;
}
else if (_eglut->api_mask & EGLUT_OPENGL_ES2_BIT) {
context_attribs[i++] = EGL_CONTEXT_CLIENT_VERSION;
context_attribs[i++] = 2;
}
context_attribs[i] = EGL_NONE;
eglBindAPI(api);
win->context = eglCreateContext(_eglut->dpy,
win->config, EGL_NO_CONTEXT, context_attribs);
if (!win->context)
_eglutFatal("failed to create context");
_eglutNativeInitWindow(win, title, x, y, w, h);
switch (_eglut->surface_type) {
case EGL_WINDOW_BIT:
win->surface = eglCreateWindowSurface(_eglut->dpy,
win->config, win->native.u.window, NULL);
break;
case EGL_PIXMAP_BIT:
win->surface = eglCreatePixmapSurface(_eglut->dpy,
win->config, win->native.u.pixmap, NULL);
break;
case EGL_PBUFFER_BIT:
win->surface = win->native.u.surface;
break;
default:
break;
}
if (win->surface == EGL_NO_SURFACE)
_eglutFatal("failed to create surface");
return win;
}
void
eglutInitAPIMask(int mask)
{
_eglut->api_mask = mask;
}
void
eglutInitWindowSize(int width, int height)
{
_eglut->window_width = width;
_eglut->window_height = height;
}
void
eglutInit(int argc, char **argv)
{
int i;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-display") == 0)
_eglut->display_name = argv[++i];
else if (strcmp(argv[i], "-info") == 0) {
_eglut->verbose = 1;
}
}
_eglutNativeInitDisplay();
_eglut->dpy = eglGetDisplay(_eglut->native_dpy);
if (!eglInitialize(_eglut->dpy, &_eglut->major, &_eglut->minor))
_eglutFatal("failed to initialize EGL display");
_eglut->init_time = _eglutNow();
printf("EGL_VERSION = %s\n", eglQueryString(_eglut->dpy, EGL_VERSION));
if (_eglut->verbose) {
printf("EGL_VENDOR = %s\n", eglQueryString(_eglut->dpy, EGL_VENDOR));
printf("EGL_EXTENSIONS = %s\n",
eglQueryString(_eglut->dpy, EGL_EXTENSIONS));
printf("EGL_CLIENT_APIS = %s\n",
eglQueryString(_eglut->dpy, EGL_CLIENT_APIS));
}
}
int
eglutGet(int state)
{
int val;
switch (state) {
case EGLUT_ELAPSED_TIME:
val = _eglutNow() - _eglut->init_time;
break;
default:
val = -1;
break;
}
return val;
}
void
eglutIdleFunc(EGLUTidleCB func)
{
_eglut->idle_cb = func;
}
void
eglutPostRedisplay(void)
{
_eglut->redisplay = 1;
}
void
eglutMainLoop(void)
{
struct eglut_window *win = _eglut->current;
if (!win)
_eglutFatal("no window is created\n");
if (win->reshape_cb)
win->reshape_cb(win->native.width, win->native.height);
_eglutNativeEventLoop();
}
static void
_eglutFini(void)
{
eglTerminate(_eglut->dpy);
_eglutNativeFiniDisplay();
}
void
eglutDestroyWindow(int win)
{
struct eglut_window *window = _eglut->current;
if (window->index != win)
return;
eglMakeCurrent(_eglut->dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
_eglutDestroyWindow(_eglut->current);
}
static void
_eglutDefaultKeyboard(unsigned char key)
{
if (key == 27) {
if (_eglut->current)
eglutDestroyWindow(_eglut->current->index);
_eglutFini();
exit(0);
}
}
int
eglutCreateWindow(const char *title)
{
struct eglut_window *win;
win = _eglutCreateWindow(title, 0, 0,
_eglut->window_width, _eglut->window_height);
win->index = _eglut->num_windows++;
win->reshape_cb = NULL;
win->display_cb = NULL;
win->keyboard_cb = _eglutDefaultKeyboard;
win->special_cb = NULL;
if (!eglMakeCurrent(_eglut->dpy, win->surface, win->surface, win->context))
_eglutFatal("failed to make window current");
_eglut->current = win;
return win->index;
}
int
eglutGetWindowWidth(void)
{
struct eglut_window *win = _eglut->current;
return win->native.width;
}
int
eglutGetWindowHeight(void)
{
struct eglut_window *win = _eglut->current;
return win->native.height;
}
void
eglutDisplayFunc(EGLUTdisplayCB func)
{
struct eglut_window *win = _eglut->current;
win->display_cb = func;
}
void
eglutReshapeFunc(EGLUTreshapeCB func)
{
struct eglut_window *win = _eglut->current;
win->reshape_cb = func;
}
void
eglutKeyboardFunc(EGLUTkeyboardCB func)
{
struct eglut_window *win = _eglut->current;
win->keyboard_cb = func;
}
void
eglutSpecialFunc(EGLUTspecialCB func)
{
struct eglut_window *win = _eglut->current;
win->special_cb = func;
}

View File

@ -0,0 +1,93 @@
/*
* Copyright (C) 2010 LunarG Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Authors:
* Chia-I Wu <olv@lunarg.com>
*/
#ifndef EGLUT_H
#define EGLUT_H
/* used by eglutInitAPIMask */
enum {
EGLUT_OPENGL_BIT = 0x1,
EGLUT_OPENGL_ES1_BIT = 0x2,
EGLUT_OPENGL_ES2_BIT = 0x4,
EGLUT_OPENVG_BIT = 0x8
};
/* used by EGLUTspecialCB */
enum {
/* function keys */
EGLUT_KEY_F1,
EGLUT_KEY_F2,
EGLUT_KEY_F3,
EGLUT_KEY_F4,
EGLUT_KEY_F5,
EGLUT_KEY_F6,
EGLUT_KEY_F7,
EGLUT_KEY_F8,
EGLUT_KEY_F9,
EGLUT_KEY_F10,
EGLUT_KEY_F11,
EGLUT_KEY_F12,
/* directional keys */
EGLUT_KEY_LEFT,
EGLUT_KEY_UP,
EGLUT_KEY_RIGHT,
EGLUT_KEY_DOWN,
};
/* used by eglutGet */
enum {
EGLUT_ELAPSED_TIME
};
typedef void (*EGLUTidleCB)(void);
typedef void (*EGLUTreshapeCB)(int, int);
typedef void (*EGLUTdisplayCB)(void);
typedef void (*EGLUTkeyboardCB)(unsigned char);
typedef void (*EGLUTspecialCB)(int);
void eglutInitAPIMask(int mask);
void eglutInitWindowSize(int width, int height);
void eglutInit(int argc, char **argv);
int eglutGet(int state);
void eglutIdleFunc(EGLUTidleCB func);
void eglutPostRedisplay(void);
void eglutMainLoop(void);
int eglutCreateWindow(const char *title);
void eglutDestroyWindow(int win);
int eglutGetWindowWidth(void);
int eglutGetWindowHeight(void);
void eglutDisplayFunc(EGLUTdisplayCB func);
void eglutReshapeFunc(EGLUTreshapeCB func);
void eglutKeyboardFunc(EGLUTkeyboardCB func);
void eglutSpecialFunc(EGLUTspecialCB func);
#endif /* EGLUT_H */

View File

@ -0,0 +1,143 @@
/**
* \brief eglut bindings for Genode Mesa demos
* \author Sebastian Sumpf
* \date 2017-08-17
*/
/*
* Copyright (C) Genode Labs GmbH
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#include <base/heap.h>
#include <base/printf.h>
#include <libc/component.h>
extern "C" {
#include "eglutint.h"
#include <sys/select.h>
}
#include <window.h>
static bool initialized = false;
Genode::Env *genode_env;
struct Eglut_env
{
Libc::Env &env;
Genode::Heap heap { env.ram(), env.rm() };
Eglut_env(Libc::Env &env) : env(env) { }
};
Genode::Constructible<Eglut_env> eglut_env;
void _eglutNativeInitDisplay()
{
_eglut->surface_type = EGL_WINDOW_BIT;
}
void Window::sync_handler()
{
struct eglut_window *win =_eglut->current;
if (_eglut->idle_cb)
_eglut->idle_cb();
if (win->display_cb)
win->display_cb();
if (initialized) {
eglSwapBuffers(_eglut->dpy, win->surface);
//XXX: required till vsync interrupt
eglWaitClient();
}
}
void Window::mode_handler()
{
if (!framebuffer.is_constructed())
return;
initialized = true;
Framebuffer::Mode mode = framebuffer->mode();
eglut_window *win = _eglut->current;
if (win) {
win->native.width = mode.width();
win->native.height = mode.height();
if (win->reshape_cb)
win->reshape_cb(win->native.width, win->native.height);
}
update();
}
void _eglutNativeFiniDisplay(void)
{
PDBG("not implemented");
}
void _eglutNativeInitWindow(struct eglut_window *win, const char *title,
int x, int y, int w, int h)
{
Genode_egl_window *native = new (eglut_env->heap) Window(eglut_env->env, w, h);
win->native.u.window = native;
win->native.width = w;
win->native.height = h;
}
void _eglutNativeFiniWindow(struct eglut_window *win)
{
PDBG("not implemented");
}
void _eglutNativeEventLoop()
{
while (true) {
select(0, nullptr, nullptr, nullptr, nullptr);
}
}
/*
* 'eglut_main' will be called instead of 'main' by component initialization
*/
extern "C" int eglut_main(int argc, char *argv[]);
void Libc::Component::construct(Libc::Env &env)
{
eglut_env.construct(env);
genode_env = &env;
Libc::with_libc([] () { eglut_main(1, nullptr); });
}

View File

@ -0,0 +1,103 @@
/*
* Copyright (C) 2010 LunarG Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Authors:
* Chia-I Wu <olv@lunarg.com>
*/
#ifndef _EGLUTINT_H_
#define _EGLUTINT_H_
#include "EGL/egl.h"
#include "eglut.h"
struct eglut_window {
EGLConfig config;
EGLContext context;
/* initialized by native display */
struct {
union {
EGLNativeWindowType window;
EGLNativePixmapType pixmap;
EGLSurface surface; /* pbuffer or screen surface */
} u;
int width, height;
} native;
EGLSurface surface;
int index;
EGLUTreshapeCB reshape_cb;
EGLUTdisplayCB display_cb;
EGLUTkeyboardCB keyboard_cb;
EGLUTspecialCB special_cb;
};
struct eglut_state {
int api_mask;
int window_width, window_height;
const char *display_name;
int verbose;
int init_time;
EGLUTidleCB idle_cb;
int num_windows;
/* initialized by native display */
EGLNativeDisplayType native_dpy;
EGLint surface_type;
EGLDisplay dpy;
EGLint major, minor;
struct eglut_window *current;
int redisplay;
};
extern struct eglut_state *_eglut;
void
_eglutFatal(char *format, ...);
int
_eglutNow(void);
void
_eglutNativeInitDisplay(void);
void
_eglutNativeFiniDisplay(void);
void
_eglutNativeInitWindow(struct eglut_window *win, const char *title,
int x, int y, int w, int h);
void
_eglutNativeFiniWindow(struct eglut_window *win);
void
_eglutNativeEventLoop(void);
#endif /* _EGLUTINT_H_ */

View File

@ -0,0 +1,15 @@
#ifndef GL_WRAP_H
#define GL_WRAP_H
#ifdef __APPLE__
# include <OpenGL/gl.h>
# include <OpenGL/glu.h>
#else
# include <GL/gl.h>
#endif
#ifndef GLAPIENTRY
#define GLAPIENTRY
#endif
#endif /* ! GL_WRAP_H */

View File

@ -10,6 +10,7 @@ append build_components [qt5_build_components feature]
append build_components {
server/clipboard server/loader server/tar_rom server/nit_fb app/launchpad test/nitpicker
lib/mesa/swrast
lib/vfs/jitterentropy
app/arora
}
@ -100,6 +101,7 @@ append config {
<service name="Nitpicker"> <child name="wm"/> </service>
<service name="Report"> <child name="clipboard"/> </service>
<service name="ROM" label="clipboard"> <child name="clipboard"/> </service>
<service name="ROM" label="egl_drv.lib.so"> <parent label="egl_swrast.lib.so" /> </service>
<any-service> <parent/> <any-child/> </any-service>
</route>
</start>
@ -135,8 +137,12 @@ append boot_modules {
# Qt5-specific boot modules
#
append boot_modules {
gallium.lib.so
egl.lib.so
egl_swrast.lib.so
expat.lib.so
glapi.lib.so
icu.lib.so
mesa.lib.so
pcre16.lib.so
pthread.lib.so
qt5_angle.lib.so