diff options
author | drumsetmonkey <abelleisle@roadrunner.com> | 2016-01-19 13:20:45 -0500 |
---|---|---|
committer | drumsetmonkey <abelleisle@roadrunner.com> | 2016-01-19 13:20:45 -0500 |
commit | c1774c591f7897c1cfa28e05fdb7c72e07890933 (patch) | |
tree | ec37af95646fbaeaeea291ee1ecb0e3dec5915cf /include | |
parent | fbd4ddbab2cc3a713430483b24642cbbc7050f0c (diff) |
Color Index can be used to color anything with a solid color
Diffstat (limited to 'include')
-rw-r--r-- | include/entities.h | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/include/entities.h b/include/entities.h index 51032ef..edf7022 100644 --- a/include/entities.h +++ b/include/entities.h @@ -88,15 +88,18 @@ public: //glColor3f(color.red,color.green,color.blue); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, colorIndex); + glUseProgram(shaderProgram); + glUniform1i(glGetUniformLocation(shaderProgram, "sampler"), 0); glEnable(GL_TEXTURE_2D); glColor3ub(255,255,255); glBegin(GL_QUADS); - glTexCoord2f(.25*index.x, .125*(index.y + 1)); glVertex2i(loc.x, loc.y); - glTexCoord2f(.25*(index.x+1), .125*(index.y + 1)); glVertex2i(loc.x + width, loc.y); - glTexCoord2f(.25*(index.x+1), .125*index.y); glVertex2i(loc.x + width, loc.y + height); - glTexCoord2f(.25*index.x, .125*index.y); glVertex2i(loc.x, loc.y + width); + glTexCoord2f(.25*index.x, .126*index.y); glVertex2i(loc.x, loc.y); + glTexCoord2f(.26*index.x, .126*index.y); glVertex2i(loc.x + width, loc.y); + glTexCoord2f(.26*index.x, .125*index.y); glVertex2i(loc.x + width, loc.y + height); + glTexCoord2f(.25*index.x, .125*index.y); glVertex2i(loc.x, loc.y + width); glEnd(); glDisable(GL_TEXTURE_2D); + glUseProgram(0); //glRectf(loc.x,loc.y,loc.x+width,loc.y+height); } bool kill(float delta){ |