gears-gles2 example added to test vivante backend.

small update in vivante_window.c
This commit is contained in:
Krylov Yaroslav 2019-05-28 17:57:44 +03:00
parent ea497286aa
commit a96436ccf1
3 changed files with 1208 additions and 7 deletions

View File

@ -38,6 +38,7 @@ set(TINYCTHREAD "${GLFW_SOURCE_DIR}/deps/tinycthread.h"
add_executable(boing WIN32 MACOSX_BUNDLE boing.c ${ICON} ${GLAD_GL}) add_executable(boing WIN32 MACOSX_BUNDLE boing.c ${ICON} ${GLAD_GL})
add_executable(gears WIN32 MACOSX_BUNDLE gears.c ${ICON} ${GLAD_GL}) add_executable(gears WIN32 MACOSX_BUNDLE gears.c ${ICON} ${GLAD_GL})
add_executable(gears-gles2 WIN32 MACOSX_BUNDLE gears-gles2.c ${ICON} ${GLAD_GL})
add_executable(heightmap WIN32 MACOSX_BUNDLE heightmap.c ${ICON} ${GLAD_GL}) add_executable(heightmap WIN32 MACOSX_BUNDLE heightmap.c ${ICON} ${GLAD_GL})
add_executable(offscreen offscreen.c ${ICON} ${GLAD_GL}) add_executable(offscreen offscreen.c ${ICON} ${GLAD_GL})
add_executable(particles WIN32 MACOSX_BUNDLE particles.c ${ICON} ${TINYCTHREAD} ${GETOPT} ${GLAD_GL}) add_executable(particles WIN32 MACOSX_BUNDLE particles.c ${ICON} ${TINYCTHREAD} ${GETOPT} ${GLAD_GL})
@ -51,7 +52,7 @@ if (RT_LIBRARY)
target_link_libraries(particles "${RT_LIBRARY}") target_link_libraries(particles "${RT_LIBRARY}")
endif() endif()
set(WINDOWS_BINARIES boing gears heightmap particles sharing simple splitview wave) set(WINDOWS_BINARIES boing gears gears-gles2 heightmap particles sharing simple splitview wave)
set(CONSOLE_BINARIES offscreen) set(CONSOLE_BINARIES offscreen)
set_target_properties(${WINDOWS_BINARIES} ${CONSOLE_BINARIES} PROPERTIES set_target_properties(${WINDOWS_BINARIES} ${CONSOLE_BINARIES} PROPERTIES
@ -66,6 +67,7 @@ endif()
if (APPLE) if (APPLE)
set_target_properties(boing PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Boing") set_target_properties(boing PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Boing")
set_target_properties(gears PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Gears") set_target_properties(gears PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Gears")
set_target_properties(gears-gles2 PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "GearsGLES2")
set_target_properties(heightmap PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Heightmap") set_target_properties(heightmap PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Heightmap")
set_target_properties(particles PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Particles") set_target_properties(particles PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Particles")
set_target_properties(sharing PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Sharing") set_target_properties(sharing PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Sharing")

1189
examples/gears-gles2.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -27,16 +27,28 @@
#include "internal.h" #include "internal.h"
static int queryWindowGeometry(_GLFWwindow* window )
{
if (!window->vivante.native_window)
return GLFW_FALSE;
fbGetWindowGeometry(window->vivante.native_window
, &window->vivante.xpos, &window->vivante.ypos
, &window->vivante.width, &window->vivante.height);
return GLFW_TRUE;
}
static int createNativeWindow(_GLFWwindow* window, static int createNativeWindow(_GLFWwindow* window,
const _GLFWwndconfig* wndconfig) const _GLFWwndconfig* wndconfig)
{ {
window->vivante.native_window = fbCreateWindow( _GLFW_EGL_NATIVE_DISPLAY, 0, 0, wndconfig->width, wndconfig->height ); window->vivante.native_window = fbCreateWindow(_GLFW_EGL_NATIVE_DISPLAY, 0, 0, 0, 0);//, wndconfig->width, wndconfig->height);
if (!window->vivante.native_window) if (!window->vivante.native_window)
return GLFW_FALSE; return GLFW_FALSE;
window->vivante.width = wndconfig->width; if (!queryWindowGeometry(window))
window->vivante.height = wndconfig->height; return GLFW_FALSE;
return GLFW_TRUE; return GLFW_TRUE;
} }
@ -119,8 +131,6 @@ void _glfwPlatformGetWindowSize(_GLFWwindow* window, int* width, int* height)
void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height) void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
{ {
window->vivante.width = width;
window->vivante.height = height;
} }
void _glfwPlatformSetWindowSizeLimits(_GLFWwindow* window, void _glfwPlatformSetWindowSizeLimits(_GLFWwindow* window,