[DEV] correct Windows Gui (missing the screen DPI) and downgrade log
This commit is contained in:
parent
a0c8a89109
commit
bac6c2db17
@ -5,6 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
#include <gale/debug.hpp>
|
#include <gale/debug.hpp>
|
||||||
#include <gale/gale.hpp>
|
#include <gale/gale.hpp>
|
||||||
|
#include <gale/Dimension.hpp>
|
||||||
#include <etk/types.hpp>
|
#include <etk/types.hpp>
|
||||||
#include <etk/os/FSNode.hpp>
|
#include <etk/os/FSNode.hpp>
|
||||||
|
|
||||||
@ -143,6 +144,25 @@ class WindowsContext : public gale::Context {
|
|||||||
MessageBox(hWnd, "Error initilizing open GL\n OPENGL 2.0 not availlable ...\n(gale internal error #75124)", "Error", MB_ICONEXCLAMATION);
|
MessageBox(hWnd, "Error initilizing open GL\n OPENGL 2.0 not availlable ...\n(gale internal error #75124)", "Error", MB_ICONEXCLAMATION);
|
||||||
PostQuitMessage(0);
|
PostQuitMessage(0);
|
||||||
}
|
}
|
||||||
|
// Configure the DPI of the screen:
|
||||||
|
{
|
||||||
|
vec2 dpi(0,0);
|
||||||
|
dpi.setX(GetDeviceCaps(hDC, LOGPIXELSX));
|
||||||
|
dpi.setY(GetDeviceCaps(hDC, LOGPIXELSY));
|
||||||
|
gale::Dimension::setPixelRatio(dpi, gale::distance::inch);
|
||||||
|
GALE_INFO("monitor property : dpi=" << dpi << " px/inch");
|
||||||
|
}
|
||||||
|
// Get monitor Size
|
||||||
|
{
|
||||||
|
HMONITOR monitor = MonitorFromWindow(hWnd, MONITOR_DEFAULTTONEAREST);
|
||||||
|
MONITORINFO info;
|
||||||
|
info.cbSize = sizeof(MONITORINFO);
|
||||||
|
GetMonitorInfo(monitor, &info);
|
||||||
|
int monitor_width = info.rcMonitor.right - info.rcMonitor.left;
|
||||||
|
int monitor_height = info.rcMonitor.bottom - info.rcMonitor.top;
|
||||||
|
GALE_INFO("monitor property: size=" << ivec2(monitor_width, monitor_height) << " px");
|
||||||
|
}
|
||||||
|
|
||||||
// Now we can show it ...
|
// Now we can show it ...
|
||||||
ShowWindow(hWnd, SW_SHOW);
|
ShowWindow(hWnd, SW_SHOW);
|
||||||
//EnableWindow(hWnd, TRUE);
|
//EnableWindow(hWnd, TRUE);
|
||||||
|
@ -784,7 +784,7 @@ static char l_bufferDisplayError[LOG_OGL_INTERNAL_BUFFER_LEN] = "";
|
|||||||
int64_t gale::openGL::shader::create(enum gale::openGL::shader::type _type) {
|
int64_t gale::openGL::shader::create(enum gale::openGL::shader::type _type) {
|
||||||
GLuint shader = 0;
|
GLuint shader = 0;
|
||||||
if (_type == gale::openGL::shader::type::vertex) {
|
if (_type == gale::openGL::shader::type::vertex) {
|
||||||
GALE_ERROR("create shader: VERTEX");
|
GALE_VERBOSE("create shader: VERTEX");
|
||||||
#ifdef GALE_SIMULATION_OPENGL_AVAILLABLE
|
#ifdef GALE_SIMULATION_OPENGL_AVAILLABLE
|
||||||
if (s_simulationMode == false) {
|
if (s_simulationMode == false) {
|
||||||
#endif
|
#endif
|
||||||
@ -796,7 +796,7 @@ int64_t gale::openGL::shader::create(enum gale::openGL::shader::type _type) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
} else if (_type == gale::openGL::shader::type::fragment) {
|
} else if (_type == gale::openGL::shader::type::fragment) {
|
||||||
GALE_ERROR("create shader: FRAGMENT");
|
GALE_VERBOSE("create shader: FRAGMENT");
|
||||||
#ifdef GALE_SIMULATION_OPENGL_AVAILLABLE
|
#ifdef GALE_SIMULATION_OPENGL_AVAILLABLE
|
||||||
if (s_simulationMode == false) {
|
if (s_simulationMode == false) {
|
||||||
#endif
|
#endif
|
||||||
@ -811,7 +811,7 @@ int64_t gale::openGL::shader::create(enum gale::openGL::shader::type _type) {
|
|||||||
GALE_ERROR("create shader with wrong type ...");
|
GALE_ERROR("create shader with wrong type ...");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
GALE_ERROR("create shader: ... (done)");
|
GALE_VERBOSE("create shader: ... (done)");
|
||||||
if (shader == 0) {
|
if (shader == 0) {
|
||||||
GALE_ERROR("glCreateShader return error ...");
|
GALE_ERROR("glCreateShader return error ...");
|
||||||
#ifdef GALE_SIMULATION_OPENGL_AVAILLABLE
|
#ifdef GALE_SIMULATION_OPENGL_AVAILLABLE
|
||||||
|
@ -33,7 +33,7 @@ void gale::resource::Program::init(const std::string& _filename) {
|
|||||||
|
|
||||||
etk::FSNode file(m_name);
|
etk::FSNode file(m_name);
|
||||||
if (file.exist() == false) {
|
if (file.exist() == false) {
|
||||||
GALE_INFO("File does not Exist : \"" << file << "\" == > automatic load of framment and shader with same names... ");
|
GALE_DEBUG("File does not Exist : \"" << file << "\" == > automatic load of framment and shader with same names... ");
|
||||||
std::string tmpFilename = m_name;
|
std::string tmpFilename = m_name;
|
||||||
// remove extention ...
|
// remove extention ...
|
||||||
tmpFilename.erase(tmpFilename.size()-4, 4);
|
tmpFilename.erase(tmpFilename.size()-4, 4);
|
||||||
@ -192,7 +192,7 @@ int32_t gale::resource::Program::getAttribute(std::string _elementName) {
|
|||||||
GALE_WARNING(" {" << m_program << "}[" << m_elementList.size() << "] glGetAttribLocation(\"" << tmp.m_name << "\") = " << tmp.m_elementId);
|
GALE_WARNING(" {" << m_program << "}[" << m_elementList.size() << "] glGetAttribLocation(\"" << tmp.m_name << "\") = " << tmp.m_elementId);
|
||||||
tmp.m_isLinked = false;
|
tmp.m_isLinked = false;
|
||||||
} else {
|
} else {
|
||||||
GALE_INFO(" {" << m_program << "}[" << m_elementList.size() << "] glGetAttribLocation(\"" << tmp.m_name << "\") = " << tmp.m_elementId);
|
GALE_DEBUG(" {" << m_program << "}[" << m_elementList.size() << "] glGetAttribLocation(\"" << tmp.m_name << "\") = " << tmp.m_elementId);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// program is not loaded ==> just local reister ...
|
// program is not loaded ==> just local reister ...
|
||||||
@ -225,7 +225,7 @@ int32_t gale::resource::Program::getUniform(std::string _elementName) {
|
|||||||
GALE_WARNING(" {" << m_program << "}[" << m_elementList.size() << "] glGetUniformLocation(\"" << tmp.m_name << "\") = " << tmp.m_elementId);
|
GALE_WARNING(" {" << m_program << "}[" << m_elementList.size() << "] glGetUniformLocation(\"" << tmp.m_name << "\") = " << tmp.m_elementId);
|
||||||
tmp.m_isLinked = false;
|
tmp.m_isLinked = false;
|
||||||
} else {
|
} else {
|
||||||
GALE_INFO(" {" << m_program << "}[" << m_elementList.size() << "] glGetUniformLocation(\"" << tmp.m_name << "\") = " << tmp.m_elementId);
|
GALE_DEBUG(" {" << m_program << "}[" << m_elementList.size() << "] glGetUniformLocation(\"" << tmp.m_name << "\") = " << tmp.m_elementId);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// program is not loaded ==> just local reister ...
|
// program is not loaded ==> just local reister ...
|
||||||
@ -246,7 +246,7 @@ bool gale::resource::Program::updateContext() {
|
|||||||
// Do nothing == > too dangerous ...
|
// Do nothing == > too dangerous ...
|
||||||
} else {
|
} else {
|
||||||
// create the Shader
|
// create the Shader
|
||||||
GALE_INFO("Create the Program ... \"" << m_name << "\"");
|
GALE_DEBUG("Create the Program ... \"" << m_name << "\"");
|
||||||
m_program = gale::openGL::program::create();
|
m_program = gale::openGL::program::create();
|
||||||
if (m_program < 0) {
|
if (m_program < 0) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -66,14 +66,14 @@ bool gale::resource::Shader::updateContext() {
|
|||||||
GALE_CRITICAL(" can not load shader");
|
GALE_CRITICAL(" can not load shader");
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
GALE_INFO("Compile shader with GLID=" << m_shader);
|
GALE_DEBUG("Compile shader with GLID=" << m_shader);
|
||||||
bool ret = gale::openGL::shader::compile(m_shader, m_fileData);
|
bool ret = gale::openGL::shader::compile(m_shader, m_fileData);
|
||||||
if (ret == false) {
|
if (ret == false) {
|
||||||
const char * tmpShaderType = "FRAGMENT SHADER";
|
const char * tmpShaderType = "FRAGMENT SHADER";
|
||||||
if (m_type == gale::openGL::shader::type::vertex){
|
if (m_type == gale::openGL::shader::type::vertex){
|
||||||
tmpShaderType = "VERTEX SHADER";
|
tmpShaderType = "VERTEX SHADER";
|
||||||
}
|
}
|
||||||
GALE_CRITICAL("Could not compile \"" << tmpShaderType << "\" name='" << m_name << "'");
|
GALE_CRITICAL("Could not compile '" << tmpShaderType << "' name='" << m_name << "'");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -120,11 +120,11 @@ void gale::resource::Shader::reload() {
|
|||||||
// now change the OGL context ...
|
// now change the OGL context ...
|
||||||
|
|
||||||
if (gale::openGL::hasContext() == true) {
|
if (gale::openGL::hasContext() == true) {
|
||||||
GALE_DEBUG("OGL : load SHADER \"" << m_name << "\" ==> call update context (direct)");
|
GALE_DEBUG("OGL : load SHADER '" << m_name << "' ==> call update context (direct)");
|
||||||
removeContext();
|
removeContext();
|
||||||
updateContext();
|
updateContext();
|
||||||
} else {
|
} else {
|
||||||
GALE_DEBUG("OGL : load SHADER \"" << m_name << "\" ==> tagged has update context needed");
|
GALE_DEBUG("OGL : load SHADER '" << m_name << "' ==> tagged has update context needed");
|
||||||
// TODO : Check this, this is a leek ==> in the GPU ... really bad ...
|
// TODO : Check this, this is a leek ==> in the GPU ... really bad ...
|
||||||
m_exist = false;
|
m_exist = false;
|
||||||
m_shader = 0;
|
m_shader = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user