Permalink
Browse files

GLVideoDriver: some fixes

  • Loading branch information...
1 parent 30953a1 commit ea789a027e5373285f7c7d2cc497ee80f58488a1 @BehoIder BehoIder committed with lynxlynxlynx Jan 23, 2014
@@ -27,7 +27,7 @@ GLSLProgram* GLSLProgram::CreateFromFiles(std::string vertexSourceFileName, std:
std::string vertexContent;
std::string fragmentContent;
- std::ifstream fileStream(vertexSourceFileName, std::ios::in);
+ std::ifstream fileStream(vertexSourceFileName.c_str());
if(!fileStream.is_open())
{
GLSLProgram::errMessage = "GLSLProgram error: Can't open file: " + vertexSourceFileName;
@@ -38,27 +38,31 @@ GLSLProgram* GLSLProgram::CreateFromFiles(std::string vertexSourceFileName, std:
{
std::getline(fileStream, line);
line.erase(line.begin(), std::find_if(line.begin(), line.end(), std::not1(std::ptr_fun<int, int>(std::isspace))));
+#ifdef USE_GL
+ // remove precisions
+ if (line.find("precision") == 0) continue;
+#endif
vertexContent.append(line + "\n");
}
fileStream.close();
- fileStream = std::ifstream(fragmentSourceFileName, std::ios::in);
- if(!fileStream.is_open())
+ std::ifstream fileStream2(fragmentSourceFileName.c_str());
+ if(!fileStream2.is_open())
{
GLSLProgram::errMessage = "GLSLProgram error: Can't open file: " + fragmentSourceFileName;
return NULL;
}
- while (!fileStream.eof())
+ while (!fileStream2.eof())
{
- std::getline(fileStream, line);
+ std::getline(fileStream2, line);
line.erase(line.begin(), std::find_if(line.begin(), line.end(), std::not1(std::ptr_fun<int, int>(std::isspace))));
#ifdef USE_GL
// remove precisions
if (line.find("precision") == 0) continue;
#endif
fragmentContent.append(line + "\n");
}
- fileStream.close();
+ fileStream2.close();
return GLSLProgram::Create(vertexContent, fragmentContent);
}
@@ -41,6 +41,6 @@ namespace GemRB
GLSLProgram(){}
~GLSLProgram(){}
};
-};
+}
#endif
@@ -432,7 +432,7 @@ void GLVideoDriver::drawEllipse(int cx /*center*/, int cy /*center*/, unsigned s
{
const float support = 0.75;
useProgram(programEllipse);
- thickness = max(thickness, 1.0);
+ if (thickness < 1.0) thickness = 1.0;
float dx = (int)ceilf(xr + thickness/2.0 + 2.5*support);
float dy = (int)ceilf(yr + thickness/2.0 + 2.5*support);
glViewport(cx - dx, height - cy - dy, dx*2, dy*2);
@@ -9,14 +9,6 @@
#define TEX_SIZE 2
#define COLOR_SIZE 4
-#ifndef max
-#define max(a,b) (((a) > (b)) ? (a) : (b))
-#endif
-
-#ifndef min
-#define min(a,b) (((a) < (b)) ? (a) : (b))
-#endif
-
#define BLIT_EXTERNAL_MASK 0x100
namespace GemRB

0 comments on commit ea789a0

Please sign in to comment.