renderGL: fix OpenGL ES stuff
This commit is contained in:
parent
b2cf64c117
commit
9c4a7cd6d4
|
@ -74,6 +74,14 @@ enum FurnaceGUIRenderBackend {
|
||||||
GUI_BACKEND_GL
|
GUI_BACKEND_GL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef HAVE_RENDER_SDL
|
||||||
|
#define GUI_BACKEND_DEFAULT GUI_BACKEND_SDL
|
||||||
|
#define GUI_BACKEND_DEFAULT_NAME "SDL"
|
||||||
|
#else
|
||||||
|
#define GUI_BACKEND_DEFAULT GUI_BACKEND_GL
|
||||||
|
#define GUI_BACKEND_DEFAULT_NAME "OpenGL"
|
||||||
|
#endif
|
||||||
|
|
||||||
// TODO:
|
// TODO:
|
||||||
// - add colors for FM envelope and waveform
|
// - add colors for FM envelope and waveform
|
||||||
// - maybe add "alternate" color for FM modulators/carriers (a bit difficult)
|
// - maybe add "alternate" color for FM modulators/carriers (a bit difficult)
|
||||||
|
|
|
@ -26,12 +26,6 @@
|
||||||
#include "render/renderGL.h"
|
#include "render/renderGL.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_RENDER_SDL
|
|
||||||
#define GUI_BACKEND_DEFAULT GUI_BACKEND_SDL
|
|
||||||
#else
|
|
||||||
#define GUI_BACKEND_DEFAULT GUI_BACKEND_GL
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool FurnaceGUI::initRender() {
|
bool FurnaceGUI::initRender() {
|
||||||
if (rend!=NULL) return false;
|
if (rend!=NULL) return false;
|
||||||
|
|
||||||
|
@ -71,4 +65,4 @@ bool FurnaceGUI::quitRender() {
|
||||||
delete rend;
|
delete rend;
|
||||||
rend=NULL;
|
rend=NULL;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include "../../ta-log.h"
|
#include "../../ta-log.h"
|
||||||
#ifdef USE_GLES
|
#ifdef USE_GLES
|
||||||
#include "SDL_opengles2.h"
|
#include "SDL_opengles2.h"
|
||||||
#define PIXEL_FORMAT GL_RGBA
|
#define PIXEL_FORMAT GL_UNSIGNED_BYTE
|
||||||
#else
|
#else
|
||||||
#include "SDL_opengl.h"
|
#include "SDL_opengl.h"
|
||||||
#define PIXEL_FORMAT GL_UNSIGNED_INT_8_8_8_8_REV
|
#define PIXEL_FORMAT GL_UNSIGNED_INT_8_8_8_8_REV
|
||||||
|
@ -62,6 +62,19 @@ struct FurnaceGLTexture {
|
||||||
lockedData(NULL) {}
|
lockedData(NULL) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef USE_GLES
|
||||||
|
const char* sh_wipe_srcV=
|
||||||
|
"attribute vec4 fur_position;\n"
|
||||||
|
"void main() {\n"
|
||||||
|
" gl_Position=fur_position;\n"
|
||||||
|
"}\n";
|
||||||
|
|
||||||
|
const char* sh_wipe_srcF=
|
||||||
|
"uniform float uAlpha;\n"
|
||||||
|
"void main() {\n"
|
||||||
|
" gl_FragColor=vec4(0.0,0.0,0.0,uAlpha);\n"
|
||||||
|
"}\n";
|
||||||
|
#else
|
||||||
const char* sh_wipe_srcV=
|
const char* sh_wipe_srcV=
|
||||||
"#version 130\n"
|
"#version 130\n"
|
||||||
"in vec4 fur_position;\n"
|
"in vec4 fur_position;\n"
|
||||||
|
@ -76,6 +89,7 @@ const char* sh_wipe_srcF=
|
||||||
"void main() {\n"
|
"void main() {\n"
|
||||||
" fur_FragColor=vec4(0.0,0.0,0.0,uAlpha);\n"
|
" fur_FragColor=vec4(0.0,0.0,0.0,uAlpha);\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
|
#endif
|
||||||
|
|
||||||
bool FurnaceGUIRenderGL::createShader(const char* vertexS, const char* fragmentS, int& vertex, int& fragment, int& program) {
|
bool FurnaceGUIRenderGL::createShader(const char* vertexS, const char* fragmentS, int& vertex, int& fragment, int& program) {
|
||||||
int status;
|
int status;
|
||||||
|
|
|
@ -1278,17 +1278,33 @@ void FurnaceGUI::drawSettings() {
|
||||||
ImVec2 settingsViewSize=ImGui::GetContentRegionAvail();
|
ImVec2 settingsViewSize=ImGui::GetContentRegionAvail();
|
||||||
settingsViewSize.y-=ImGui::GetFrameHeight()+ImGui::GetStyle().WindowPadding.y;
|
settingsViewSize.y-=ImGui::GetFrameHeight()+ImGui::GetStyle().WindowPadding.y;
|
||||||
if (ImGui::BeginChild("SettingsView",settingsViewSize)) {
|
if (ImGui::BeginChild("SettingsView",settingsViewSize)) {
|
||||||
if (ImGui::BeginCombo("Render driver",settings.renderDriver.empty()?"Automatic":settings.renderDriver.c_str())) {
|
String curRenderBackend=settings.renderBackend.empty()?GUI_BACKEND_DEFAULT_NAME:settings.renderBackend;
|
||||||
if (ImGui::Selectable("Automatic",settings.renderDriver.empty())) {
|
if (ImGui::BeginCombo("Render backend",curRenderBackend.c_str())) {
|
||||||
settings.renderDriver="";
|
#ifdef HAVE_RENDER_SDL
|
||||||
|
if (ImGui::Selectable("SDL Renderer",curRenderBackend=="SDL")) {
|
||||||
|
settings.renderBackend="SDL";
|
||||||
}
|
}
|
||||||
for (String& i: availRenderDrivers) {
|
#endif
|
||||||
if (ImGui::Selectable(i.c_str(),i==settings.renderDriver)) {
|
#ifdef HAVE_RENDER_GL
|
||||||
settings.renderDriver=i;
|
if (ImGui::Selectable("OpenGL",curRenderBackend=="OpenGL")) {
|
||||||
}
|
settings.renderBackend="OpenGL";
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
ImGui::EndCombo();
|
ImGui::EndCombo();
|
||||||
}
|
}
|
||||||
|
if (curRenderBackend=="SDL") {
|
||||||
|
if (ImGui::BeginCombo("Render driver",settings.renderDriver.empty()?"Automatic":settings.renderDriver.c_str())) {
|
||||||
|
if (ImGui::Selectable("Automatic",settings.renderDriver.empty())) {
|
||||||
|
settings.renderDriver="";
|
||||||
|
}
|
||||||
|
for (String& i: availRenderDrivers) {
|
||||||
|
if (ImGui::Selectable(i.c_str(),i==settings.renderDriver)) {
|
||||||
|
settings.renderDriver=i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ImGui::EndCombo();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool dpiScaleAuto=(settings.dpiScale<0.5f);
|
bool dpiScaleAuto=(settings.dpiScale<0.5f);
|
||||||
if (ImGui::Checkbox("Automatic UI scaling factor",&dpiScaleAuto)) {
|
if (ImGui::Checkbox("Automatic UI scaling factor",&dpiScaleAuto)) {
|
||||||
|
|
Loading…
Reference in New Issue