mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-06 03:29:44 -06:00
Set window icon for all windows (#864)
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
# #
|
||||
# OpenSpace #
|
||||
# #
|
||||
# Copyright (c) 2014-2018 #
|
||||
# Copyright (c) 2014-2019 #
|
||||
# #
|
||||
# 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 #
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# #
|
||||
# OpenSpace #
|
||||
# #
|
||||
# Copyright (c) 2014-2018 #
|
||||
# Copyright (c) 2014-2019 #
|
||||
# #
|
||||
# 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 #
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
#include <sgct.h>
|
||||
#include <chrono>
|
||||
#include <ctime>
|
||||
#include <stb_image.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <openspace/openspace.h>
|
||||
@@ -262,11 +263,46 @@ void mainInitFunc() {
|
||||
openspace::global::openSpaceEngine.initialize();
|
||||
LDEBUG("Initializing OpenSpace Engine finished");
|
||||
|
||||
{
|
||||
std::string path = absPath("${DATA}/openspace-icon.png");
|
||||
int x;
|
||||
int y;
|
||||
int n;
|
||||
unsigned char* data = stbi_load(path.c_str(), &x, &y, &n, 0);
|
||||
|
||||
GLFWimage icons[1];
|
||||
icons[0].pixels = data;
|
||||
icons[0].width = x;
|
||||
icons[0].height = y;
|
||||
|
||||
const size_t nWindows = SgctEngine->getNumberOfWindows();
|
||||
for (size_t i = 0; i < nWindows; ++i) {
|
||||
const sgct::SGCTWindow* windowPtr = SgctEngine->getWindowPtr(i);
|
||||
glfwSetWindowIcon(windowPtr->getWindowHandle(), 1, icons);
|
||||
}
|
||||
|
||||
stbi_image_free(icons[0].pixels);
|
||||
}
|
||||
|
||||
|
||||
|
||||
LDEBUG("Initializing OpenGL in OpenSpace Engine started");
|
||||
openspace::global::openSpaceEngine.initializeGL();
|
||||
LDEBUG("Initializing OpenGL in OpenSpace Engine finished");
|
||||
|
||||
{
|
||||
|
||||
//using namespace ghoul::opengl;
|
||||
//std::unique_ptr<ghoul::opengl::Texture> t = ghoul::io::TextureReader::ref().loadTexture(absPath("${DATA}/openspace-icon.png"));
|
||||
|
||||
|
||||
//GLFWimage icons[1];
|
||||
//icons[0].pixels =
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Find if we have at least one OpenVR window
|
||||
// Save reference to first OpenVR window, which is the one we will copy to the HMD.
|
||||
for (size_t i = 0; i < SgctEngine->getNumberOfWindows(); ++i) {
|
||||
|
||||
Submodule ext/ghoul updated: e3a388183c...810483aa96
Reference in New Issue
Block a user