mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-23 04:55:13 +00:00
renderGL: fix OpenGL ES stuff
This commit is contained in:
parent
b2cf64c117
commit
9c4a7cd6d4
4 changed files with 47 additions and 15 deletions
|
@ -74,6 +74,14 @@ enum FurnaceGUIRenderBackend {
|
|||
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:
|
||||
// - add colors for FM envelope and waveform
|
||||
// - maybe add "alternate" color for FM modulators/carriers (a bit difficult)
|
||||
|
|
|
@ -26,12 +26,6 @@
|
|||
#include "render/renderGL.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_RENDER_SDL
|
||||
#define GUI_BACKEND_DEFAULT GUI_BACKEND_SDL
|
||||
#else
|
||||
#define GUI_BACKEND_DEFAULT GUI_BACKEND_GL
|
||||
#endif
|
||||
|
||||
bool FurnaceGUI::initRender() {
|
||||
if (rend!=NULL) return false;
|
||||
|
||||
|
@ -71,4 +65,4 @@ bool FurnaceGUI::quitRender() {
|
|||
delete rend;
|
||||
rend=NULL;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include "../../ta-log.h"
|
||||
#ifdef USE_GLES
|
||||
#include "SDL_opengles2.h"
|
||||
#define PIXEL_FORMAT GL_RGBA
|
||||
#define PIXEL_FORMAT GL_UNSIGNED_BYTE
|
||||
#else
|
||||
#include "SDL_opengl.h"
|
||||
#define PIXEL_FORMAT GL_UNSIGNED_INT_8_8_8_8_REV
|
||||
|
@ -62,6 +62,19 @@ struct FurnaceGLTexture {
|
|||
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=
|
||||
"#version 130\n"
|
||||
"in vec4 fur_position;\n"
|
||||
|
@ -76,6 +89,7 @@ const char* sh_wipe_srcF=
|
|||
"void main() {\n"
|
||||
" fur_FragColor=vec4(0.0,0.0,0.0,uAlpha);\n"
|
||||
"}\n";
|
||||
#endif
|
||||
|
||||
bool FurnaceGUIRenderGL::createShader(const char* vertexS, const char* fragmentS, int& vertex, int& fragment, int& program) {
|
||||
int status;
|
||||
|
|
|
@ -1278,17 +1278,33 @@ void FurnaceGUI::drawSettings() {
|
|||
ImVec2 settingsViewSize=ImGui::GetContentRegionAvail();
|
||||
settingsViewSize.y-=ImGui::GetFrameHeight()+ImGui::GetStyle().WindowPadding.y;
|
||||
if (ImGui::BeginChild("SettingsView",settingsViewSize)) {
|
||||
if (ImGui::BeginCombo("Render driver",settings.renderDriver.empty()?"Automatic":settings.renderDriver.c_str())) {
|
||||
if (ImGui::Selectable("Automatic",settings.renderDriver.empty())) {
|
||||
settings.renderDriver="";
|
||||
String curRenderBackend=settings.renderBackend.empty()?GUI_BACKEND_DEFAULT_NAME:settings.renderBackend;
|
||||
if (ImGui::BeginCombo("Render backend",curRenderBackend.c_str())) {
|
||||
#ifdef HAVE_RENDER_SDL
|
||||
if (ImGui::Selectable("SDL Renderer",curRenderBackend=="SDL")) {
|
||||
settings.renderBackend="SDL";
|
||||
}
|
||||
for (String& i: availRenderDrivers) {
|
||||
if (ImGui::Selectable(i.c_str(),i==settings.renderDriver)) {
|
||||
settings.renderDriver=i;
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_RENDER_GL
|
||||
if (ImGui::Selectable("OpenGL",curRenderBackend=="OpenGL")) {
|
||||
settings.renderBackend="OpenGL";
|
||||
}
|
||||
#endif
|
||||
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);
|
||||
if (ImGui::Checkbox("Automatic UI scaling factor",&dpiScaleAuto)) {
|
||||
|
|
Loading…
Reference in a new issue