Permalink
Browse files

Some bugfixes

  • Loading branch information...
BehoIder authored and lynxlynxlynx committed Jan 8, 2014
1 parent f571add commit 5e1e4553c358b0a787d865db3426313a61f8eda5
@@ -12,7 +12,7 @@ using namespace GemRB;
static Uint8 GetShiftValue(Uint32 value)
{
- for(int i=0; i<sizeof(value)*8; i+=8)
+ for(unsigned int i=0; i<sizeof(value)*8; i+=8)
{
if(((value >> i) & 0x1) > 0) return i;
}
@@ -125,7 +125,7 @@ void GLTextureSprite2D::createGlTexture()
if(Bpp == 32) // true color textures
{
int* buffer = new int[Width * Height];
- for(int i = 0; i < Width*Height; i++)
+ for(unsigned int i = 0; i < Width*Height; i++)
{
Uint32 src = ((Uint32*) pixels)[i];
Uint8 r = (src & rMask) >> GetShiftValue(rMask);
@@ -178,7 +178,6 @@ int GLVideoDriver::CreateDisplay(int w, int h, int bpp, bool fs, const char* tit
return GEM_ERROR;
}
SDL_GL_MakeCurrent(window, context);
- GLenum e = glGetError();
renderer = SDL_CreateRenderer(window, -1, 0);
@@ -23,7 +23,7 @@ ShaderOperationResult* Shader::BuildShader(GLenum type, const char* source)
{
char tmp[2048];
glGetShaderInfoLog(id, sizeof(tmp), 0, tmp);
- opResult->Id = -1;
+ opResult->Id = 0;
//sprintf(tmp, "%s shader compile error: %s", (type == GL_VERTEX_SHADER) ? "Vertex" : "Fragment", tmp);
opResult->Message = tmp;
}
@@ -35,9 +35,9 @@ ShaderOperationResult* Shader::BuildProgram(const char* vertexSource, const char
GLuint id = glCreateProgram();
ShaderOperationResult* vertexShader = BuildShader(GL_VERTEX_SHADER, vertexSource);
- if (vertexShader->Id == -1) return vertexShader;
+ if (vertexShader->Id == 0) return vertexShader;
ShaderOperationResult* fragmentShader = BuildShader(GL_FRAGMENT_SHADER, fragmentSource);
- if (fragmentShader->Id == -1) return fragmentShader;
+ if (fragmentShader->Id == 0) return fragmentShader;
glAttachShader(id, vertexShader->Id);
glAttachShader(id, fragmentShader->Id);
@@ -51,7 +51,7 @@ ShaderOperationResult* Shader::BuildProgram(const char* vertexSource, const char
if (result != GL_TRUE)
{
char tmp[2048];
- opResult->Id = -1;
+ opResult->Id = 0;
glGetProgramInfoLog(id, sizeof(tmp), 0, tmp);
tmp[strlen(tmp)]='\0';
opResult->Message = tmp;
@@ -2,13 +2,13 @@
class ShaderOperationResult
{
public:
- unsigned Id;
+ GLuint Id;
char* Message;
};
class Shader
{
public:
static ShaderOperationResult* BuildShader(GLenum type, const char* source);
- static ShaderOperationResult* Shader::BuildProgram(const char* vertexSource, const char* fragmentSource);
+ static ShaderOperationResult* BuildProgram(const char* vertexSource, const char* fragmentSource);
};

0 comments on commit 5e1e455

Please sign in to comment.