aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authordrumsetmonkey <abelleisle@roadrunner.com>2016-05-10 11:53:49 -0400
committerdrumsetmonkey <abelleisle@roadrunner.com>2016-05-10 11:53:49 -0400
commit7487b029fa110388e90fd092bf3c3b9a4dcee08b (patch)
tree1fd080c162bdefc6e3ab1709380f0e4753da8aaa /src
parent50bfb70e9a1788e6f64800001919e3d8386eb81d (diff)
Draw Rect
Diffstat (limited to 'src')
-rw-r--r--src/common.cpp44
-rw-r--r--src/inventory.cpp22
-rw-r--r--src/texture.cpp56
-rw-r--r--src/ui.cpp277
4 files changed, 310 insertions, 89 deletions
diff --git a/src/common.cpp b/src/common.cpp
index 77be098..05a5f35 100644
--- a/src/common.cpp
+++ b/src/common.cpp
@@ -34,6 +34,50 @@ std::vector<std::string> StringTokenizer(const std::string& str, char delim)
return tokens;
}
+static GLuint *Gshader;
+static GLint *tex_uni;
+static GLint *coord_attrib;
+static GLint *tex_attrib;
+
+void useShader(GLuint *sh, GLint *tu, GLint *ca, GLint *ta)
+{
+ Gshader = sh;
+ tex_uni = tu;
+ coord_attrib = ca;
+ tex_attrib = ta;
+}
+
+void drawRect(vec2 ll, vec2 ur)
+{
+ GLfloat verts[] = {ll.x, ll.y, 1.0,
+ ur.x, ll.y, 1.0,
+ ur.x, ur.y, 1.0,
+
+ ur.x, ur.y, 1.0,
+ ll.x, ur.y, 1.0,
+ ll.x, ll.y, 1.0};
+
+ GLfloat tex[] = {0.0, 0.0,
+ 1.0, 0.0,
+ 1.0, 1.0,
+
+ 1.0, 1.0,
+ 0.0, 1.0,
+ 0.0, 0.0};
+
+ glUniform1i(*tex_uni, 0);
+
+ glEnableVertexAttribArray(*coord_attrib);
+ glEnableVertexAttribArray(*tex_attrib);
+
+ glVertexAttribPointer(*coord_attrib, 3, GL_FLOAT, GL_FALSE, 0, verts);
+ glVertexAttribPointer(*tex_attrib, 2, GL_FLOAT, GL_FALSE, 0, tex);
+ glDrawArrays(GL_TRIANGLES, 0, 6);
+
+ glDisableVertexAttribArray(*tex_attrib);
+ glDisableVertexAttribArray(*coord_attrib);
+}
+
void DEBUG_prints(const char* file, int line, const char *s,...)
{
va_list args;
diff --git a/src/inventory.cpp b/src/inventory.cpp
index a1181e2..7f58d30 100644
--- a/src/inventory.cpp
+++ b/src/inventory.cpp
@@ -404,15 +404,21 @@ void Inventory::draw(void) {
C("Start drawing inventory");
if (invOpen) {
-
+ useShader(&textShader,
+ &textShader_uniform_texture,
+ &textShader_attribute_coord,
+ &textShader_attribute_tex);
for(auto &mr : massRay) {
- glColor4f(0.0f,0.0f,0.0f, ((float)massDfp[a]/(float)massRange)*.5f);
- glBegin(GL_QUADS);
- glVertex2i(mr.x-(itemWide/2), mr.y-(itemWide/2));
- glVertex2i(mr.x-(itemWide/2)+itemWide,mr.y-(itemWide/2));
- glVertex2i(mr.x-(itemWide/2)+itemWide,mr.y-(itemWide/2)+itemWide);
- glVertex2i(mr.x-(itemWide/2), mr.y-(itemWide/2)+itemWide);
- glEnd();
+ float t = (((float)massDfp[a]/(float)massRange)*.5f);
+ glActiveTexture(GL_TEXTURE0);
+ glUseProgram(textShader);
+
+ glBindTexture(GL_TEXTURE_2D, Texture::genColor(Color(0.0f,0.0f,0.0f, t >= 0? 255*t : 0)));
+ glUniform1i(textShader_uniform_texture, 0);
+
+ drawRect(vec2(mr.x-(itemWide/2), mr.y-(itemWide/2)), vec2(mr.x-(itemWide/2)+itemWide, mr.y-(itemWide/2)+itemWide));
+
+ glUseProgram(0);
if (!Items.empty() && a+numSlot < Items.size() && Items[a+numSlot].second) {
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, Items[a+numSlot].first->tex->image[0]);//itemtex[items[a+numSlot].id]);
diff --git a/src/texture.cpp b/src/texture.cpp
index d457831..0f01c83 100644
--- a/src/texture.cpp
+++ b/src/texture.cpp
@@ -19,6 +19,19 @@ struct index_t {
int indexy;
};
+// convert any type to octal
+template <typename T>
+uint toOctal(T toConvert)
+{
+ int n = 0;
+ uint t = 0;
+ while (toConvert > 0) {
+ t += (pow(10, n++)) * (static_cast<int>(toConvert) % 8);
+ toConvert /= 8;
+ }
+ return t;
+}
+
/**
* A vector of all loaded textures.
*
@@ -89,6 +102,49 @@ namespace Texture{
return object;
}
+ GLuint genColor(Color c)
+ {
+ std::string out;
+
+ // add the red
+ out += static_cast<int>(c.red);
+
+ // add the green
+ out += static_cast<int>(c.green);
+
+ // add the blue
+ out += static_cast<int>(c.blue);
+
+ // add the alpha
+ out += static_cast<int>(c.alpha);
+
+ GLuint object;
+
+ glActiveTexture(GL_TEXTURE0);
+ glGenTextures(1,&object); // Turns "object" into a texture
+ glBindTexture(GL_TEXTURE_2D,object); // Binds "object" to the top of the stack
+ //glPixelStorei(GL_UNPACK_ALIGNMENT,1);
+
+ //glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); // Sets the "min" filter
+ //glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); // The the "max" filter of the stack
+
+ //glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); // Wrap the texture to the matrix
+ //glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); //
+
+ glTexImage2D(GL_TEXTURE_2D, // Sets the texture to the image file loaded above
+ 0, // level
+ GL_RGBA, // internal format
+ 1, // width
+ 1, // height
+ 0, // border
+ GL_RGBA, // image format
+ GL_UNSIGNED_BYTE, // type
+ out.data() // source
+ );
+
+ return object;
+ }
+
dim2 imageDim(std::string fileName) {
for(auto &t : LoadedTexture) {
if (t.name == fileName)
diff --git a/src/ui.cpp b/src/ui.cpp
index 6a68cc0..0b58f0d 100644
--- a/src/ui.cpp
+++ b/src/ui.cpp
@@ -294,8 +294,8 @@ namespace ui {
*/
glActiveTexture(GL_TEXTURE0);
- glUniform1i(textShader_uniform_texture, 0);
glBindTexture(GL_TEXTURE_2D,(*ftex)[c-33]);
+ glUniform1i(textShader_uniform_texture, 0);
//glDisable(GL_DEPTH_TEST);
@@ -639,11 +639,6 @@ namespace ui {
}
void drawBox(vec2 c1, vec2 c2) {
- static vec2 lineIndexF = Texture::getIndex(Color(255, 255, 255));
- static vec2 lineIndex = vec2(0.25f * lineIndexF.x, 0.125f * (8-lineIndexF.y));
- static vec2 boxIndexF = Texture::getIndex(Color(0, 0, 0));
- static vec2 boxIndex = vec2(0.25f * boxIndexF.x, 0.125f * (8-boxIndexF.y));
-
GLfloat box[] = {c1.x, c1.y, 1.0,
c2.x, c1.y, 1.0,
c2.x, c2.y, 1.0,
@@ -655,26 +650,23 @@ namespace ui {
GLfloat line_strip[] = {c1.x, c1.y, 1.0,
c2.x + 1, c1.y, 1.0,
c2.x + 1, c2.y, 1.0,
- c1.x - 1, c2.y, 1.0,
+ c1.x, c2.y, 1.0,
c1.x, c1.y, 1.0};
- static GLfloat box_tex[] = {boxIndex.x,boxIndex.y,
- boxIndex.x,boxIndex.y,
- boxIndex.x,boxIndex.y,
+ GLfloat box_tex[] = {0,0,
+ 1,0,
+ 1,1,
- boxIndex.x,boxIndex.y,
- boxIndex.x,boxIndex.y,
- boxIndex.x,boxIndex.y};
+ 1,1,
+ 0,1,
+ 0,0};
- static GLfloat line_tex[] = {lineIndex.x, lineIndex.y,
- lineIndex.x, lineIndex.y,
- lineIndex.x, lineIndex.y,
- lineIndex.x, lineIndex.y,
- lineIndex.x, lineIndex.y};
+ static GLuint boxT = Texture::genColor(Color(0,0,0));
+ static GLuint lineT = Texture::genColor(Color(255,255,255));
- glActiveTexture(GL_TEXTURE9);
- glBindTexture(GL_TEXTURE_2D, colorIndex);
- glUniform1i(textShader_uniform_texture, 9);
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(GL_TEXTURE_2D, boxT);
+ glUniform1i(textShader_uniform_texture, 0);
glUseProgram(textShader);
glEnableVertexAttribArray(textShader_attribute_coord);
@@ -683,16 +675,18 @@ namespace ui {
glVertexAttribPointer(textShader_attribute_coord, 3, GL_FLOAT, GL_FALSE, 0, box);
glVertexAttribPointer(textShader_attribute_tex, 2, GL_FLOAT, GL_FALSE, 0, box_tex);
glDrawArrays(GL_TRIANGLES, 0 ,6);
-
- glVertexAttribPointer(textShader_attribute_coord, 3, GL_FLOAT, GL_FALSE, 0, line_strip);
- glVertexAttribPointer(textShader_attribute_tex, 2, GL_FLOAT, GL_FALSE, 0, line_tex);
- glDrawArrays(GL_LINE_STRIP, 0 ,5);
+
+ glBindTexture(GL_TEXTURE_2D, lineT);
+ glUniform1i(textShader_uniform_texture, 0);
+ glVertexAttribPointer(textShader_attribute_coord, 3, GL_FLOAT, GL_FALSE, 0, line_strip);
+ glVertexAttribPointer(textShader_attribute_tex, 2, GL_FLOAT, GL_FALSE, 0, box_tex);
+ glDrawArrays(GL_LINE_STRIP, 0 ,8);
+
glDisableVertexAttribArray(textShader_attribute_coord);
glDisableVertexAttribArray(textShader_attribute_tex);
glUseProgram(0);
- glActiveTexture(GL_TEXTURE0);
}
void draw(void){
@@ -700,22 +694,46 @@ namespace ui {
float x,y,tmp;
std::string rtext;
- auto SCREEN_WIDTH = game::SCREEN_WIDTH;
- auto SCREEN_HEIGHT = game::SCREEN_HEIGHT;
+ auto SCREEN_WIDTH = static_cast<float>(game::SCREEN_WIDTH);
+ auto SCREEN_HEIGHT = static_cast<float>(game::SCREEN_HEIGHT);
// will return if not toggled
action::draw(vec2 {player->loc.x + player->width / 2, player->loc.y + player->height + game::HLINE});
if (pageTexReady) {
- glEnable(GL_TEXTURE_2D);
- glBindTexture(GL_TEXTURE_2D, pageTex);
- glBegin(GL_QUADS);
- glTexCoord2i(0, 0); glVertex2i(offset.x - 300, SCREEN_HEIGHT - 100);
- glTexCoord2i(1, 0); glVertex2i(offset.x + 300, SCREEN_HEIGHT - 100);
- glTexCoord2i(1, 1); glVertex2i(offset.x + 300, SCREEN_HEIGHT - 600);
- glTexCoord2i(0, 1); glVertex2i(offset.x - 300, SCREEN_HEIGHT - 600);
- glEnd();
- glDisable(GL_TEXTURE_2D);
+
+ GLfloat page_loc[] = {offset.x - 300, SCREEN_HEIGHT - 100, 1.0,
+ offset.x + 300, SCREEN_HEIGHT - 100, 1.0,
+ offset.x + 300, SCREEN_HEIGHT - 600, 1.0,
+
+ offset.x + 300, SCREEN_HEIGHT - 600, 1.0,
+ offset.x - 300, SCREEN_HEIGHT - 600, 1.0,
+ offset.x - 300, SCREEN_HEIGHT - 100, 1.0};
+
+ GLfloat page_tex[] = {0.0, 0.0,
+ 1.0, 0.0,
+ 1.0, 1.0,
+
+ 1.0, 1.0,
+ 0.0, 1.0,
+ 0.0, 0.0};
+
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(GL_TEXTURE_2D, pageTex);
+ glUniform1i(textShader_uniform_texture, 0);
+ glUseProgram(textShader);
+
+ glEnableVertexAttribArray(textShader_attribute_coord);
+ glEnableVertexAttribArray(textShader_attribute_tex);
+
+ glVertexAttribPointer(textShader_attribute_coord, 3, GL_FLOAT, GL_FALSE, 0, page_loc);
+ glVertexAttribPointer(textShader_attribute_tex, 2, GL_FLOAT, GL_FALSE, 0, page_tex);
+ glDrawArrays(GL_TRIANGLES, 0 ,6);
+
+ glDisableVertexAttribArray(textShader_attribute_coord);
+ glDisableVertexAttribArray(textShader_attribute_tex);
+
+ glUseProgram(0);
} else if (dialogBoxExists) {
rtext = typeOut(dialogBoxText);
@@ -756,25 +774,53 @@ namespace ui {
putStringCentered(merchBase.x - SCREEN_WIDTH / 10 , merchBase.y + 40 + fontSize , merchTrade.item[1]);
putStringCentered(offset.x, merchBase.y + 60, "for");
- glEnable(GL_TEXTURE_2D);
-
- glBindTexture(GL_TEXTURE_2D, getItemTexture(merchTrade.item[0]));
- glBegin(GL_QUADS);
- glTexCoord2d(0,1);glVertex2f(offset.x - (SCREEN_WIDTH / 10) ,offset.y + (SCREEN_HEIGHT/5));
- glTexCoord2d(1,1);glVertex2f(offset.x - (SCREEN_WIDTH / 10) + 40,offset.y + (SCREEN_HEIGHT/5));
- glTexCoord2d(1,0);glVertex2f(offset.x - (SCREEN_WIDTH / 10) + 40,offset.y + (SCREEN_HEIGHT/5) + 40);
- glTexCoord2d(0,0);glVertex2f(offset.x - (SCREEN_WIDTH / 10) ,offset.y + (SCREEN_HEIGHT/5) + 40);
- glEnd();
-
- glBindTexture(GL_TEXTURE_2D, getItemTexture(merchTrade.item[1]));
- glBegin(GL_QUADS);
- glTexCoord2d(0,1);glVertex2f(offset.x + (SCREEN_WIDTH / 10) - 40,offset.y + (SCREEN_HEIGHT/5));
- glTexCoord2d(1,1);glVertex2f(offset.x + (SCREEN_WIDTH / 10) ,offset.y + (SCREEN_HEIGHT/5));
- glTexCoord2d(1,0);glVertex2f(offset.x + (SCREEN_WIDTH / 10) ,offset.y + (SCREEN_HEIGHT/5) + 40);
- glTexCoord2d(0,0);glVertex2f(offset.x + (SCREEN_WIDTH / 10) - 40,offset.y + (SCREEN_HEIGHT/5) + 40);
- glEnd();
-
- glDisable(GL_TEXTURE_2D);
+ // render the two items we are trading
+ GLfloat item_tex[] = {0.0, 1.0,
+ 1.0, 1.0,
+ 1.0, 0.0,
+
+ 1.0, 0.0,
+ 0.0, 0.0,
+ 0.0, 1.0};
+
+ GLfloat left_item[] = {offset.x - (SCREEN_WIDTH / 10), offset.y + (SCREEN_HEIGHT / 5), 1.0,
+ offset.x - (SCREEN_WIDTH / 10) + 40, offset.y + (SCREEN_HEIGHT / 5), 1.0,
+ offset.x - (SCREEN_WIDTH / 10) + 40, offset.y + (SCREEN_HEIGHT / 5) + 40,1.0,
+
+ offset.x - (SCREEN_WIDTH / 10) + 40, offset.y + (SCREEN_HEIGHT / 5) + 40,1.0,
+ offset.x - (SCREEN_WIDTH / 10), offset.y + (SCREEN_HEIGHT / 5) + 40,1.0,
+ offset.x - (SCREEN_WIDTH / 10), offset.y + (SCREEN_HEIGHT / 5), 1.0};
+
+ GLfloat right_item[] = {offset.x + (SCREEN_WIDTH / 10) - 40, offset.y + (SCREEN_HEIGHT / 5), 1.0,
+ offset.x + (SCREEN_WIDTH / 10), offset.y + (SCREEN_HEIGHT / 5), 1.0,
+ offset.x + (SCREEN_WIDTH / 10), offset.y + (SCREEN_HEIGHT / 5) + 40,1.0,
+
+ offset.x + (SCREEN_WIDTH / 10), offset.y + (SCREEN_HEIGHT / 5) + 40,1.0,
+ offset.x + (SCREEN_WIDTH / 10) - 40, offset.y + (SCREEN_HEIGHT / 5) + 40,1.0,
+ offset.x + (SCREEN_WIDTH / 10) - 40, offset.y + (SCREEN_HEIGHT / 5), 1.0};
+
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(GL_TEXTURE_2D, getItemTexture(merchTrade.item[0]));
+ glUniform1i(textShader_uniform_texture, 0);
+ glUseProgram(textShader);
+
+ glEnableVertexAttribArray(textShader_attribute_coord);
+ glEnableVertexAttribArray(textShader_attribute_tex);
+
+ glVertexAttribPointer(textShader_attribute_coord, 3, GL_FLOAT, GL_FALSE, 0, left_item);
+ glVertexAttribPointer(textShader_attribute_tex, 2, GL_FLOAT, GL_FALSE, 0, item_tex);
+ glDrawArrays(GL_TRIANGLES, 0 ,6);
+
+ glBindTexture(GL_TEXTURE_2D, getItemTexture(merchTrade.item[1]));
+
+ glVertexAttribPointer(textShader_attribute_coord, 3, GL_FLOAT, GL_FALSE, 0, right_item);
+ glVertexAttribPointer(textShader_attribute_tex, 2, GL_FLOAT, GL_FALSE, 0, item_tex);
+ glDrawArrays(GL_TRIANGLES, 0 ,6);
+
+ glDisableVertexAttribArray(textShader_attribute_coord);
+ glDisableVertexAttribArray(textShader_attribute_tex);
+
+ glUseProgram(0);
merchArrowLoc[0].x = offset.x - (SCREEN_WIDTH / 8.5) - 16;
merchArrowLoc[1].x = offset.x + (SCREEN_WIDTH / 8.5) + 16;
@@ -789,14 +835,34 @@ namespace ui {
(mouse.x < merchArrowLoc[i].x && mouse.x > merchArrowLoc[i].z)) &&
mouse.y > merchArrowLoc[i].y - 8 && mouse.y < merchArrowLoc[i].y + 8) {
glColor3ub(255,255, 0);
- }else{
+ glBindTexture(GL_TEXTURE_2D, Texture::genColor(Color(255,255,0)));
+ }else{
glColor3ub(255,255,255);
+ glBindTexture(GL_TEXTURE_2D, Texture::genColor(Color(255,255,255)));
}
- glBegin(GL_TRIANGLES);
- glVertex2f(merchArrowLoc[i].x,merchArrowLoc[i].y);
- glVertex2f(merchArrowLoc[i].z,merchArrowLoc[i].y-8);
- glVertex2f(merchArrowLoc[i].z,merchArrowLoc[i].y+8);
- glEnd();
+
+ GLfloat tri_t[] = {0.0, 0.0,
+ 0.0, 1.0,
+ 1.0, 1.0};
+
+ GLfloat tri_c[] = {merchArrowLoc[i].x, merchArrowLoc[i].y, 1.0,
+ merchArrowLoc[i].z, merchArrowLoc[i].y - 8, 1.0,
+ merchArrowLoc[i].z, merchArrowLoc[i].y + 8, 1.0};
+
+ glUniform1i(textShader_uniform_texture, 0);
+ glUseProgram(textShader);
+
+ glEnableVertexAttribArray(textShader_attribute_coord);
+ glEnableVertexAttribArray(textShader_attribute_tex);
+
+ glVertexAttribPointer(textShader_attribute_coord, 3, GL_FLOAT, GL_FALSE, 0, tri_c);
+ glVertexAttribPointer(textShader_attribute_tex, 2, GL_FLOAT, GL_FALSE, 0, tri_t);
+ glDrawArrays(GL_TRIANGLES, 0 ,6);
+
+ glDisableVertexAttribArray(textShader_attribute_coord);
+ glDisableVertexAttribArray(textShader_attribute_tex);
+
+ glUseProgram(0);
}
@@ -865,18 +931,47 @@ namespace ui {
(unsigned)player->maxHealth
);
if (player->isAlive()) {
- glColor3ub(150,0,0);
hub.y-=fontSize*1.15;
- glRectf(hub.x,
- hub.y,
- hub.x+150,
- hub.y+12);
- glColor3ub(255,0,0);
- glRectf(hub.x,
- hub.y,
- hub.x+(player->health/player->maxHealth * 150),
- hub.y+12);
- }
+
+ GLfloat tex[] = {0.0, 0.0,
+ 1.0, 0.0,
+ 0.0, 1.0,
+ 1.0, 1.0};
+
+ GLfloat back[] = {hub.x, hub.y, 1.0,
+ hub.x + 150, hub.y, 1.0,
+ hub.x, hub.y + 12, 1.0,
+ hub.x + 150, hub.y + 12, 1.0};
+
+ GLfloat front[] = {hub.x, hub.y, 1.0,
+ hub.x + 150, hub.y, 1.0,
+ hub.x, hub.y + 12, 1.0,
+ hub.x + 150, hub.y + 12, 1.0};
+
+
+ glUniform1i(textShader_uniform_texture, 0);
+ glUseProgram(textShader);
+
+ glEnableVertexAttribArray(textShader_attribute_coord);
+ glEnableVertexAttribArray(textShader_attribute_tex);
+
+ glBindTexture(GL_TEXTURE_2D, Texture::genColor(Color(150,0,0)));
+
+ glVertexAttribPointer(textShader_attribute_coord, 3, GL_FLOAT, GL_FALSE, 0, front);
+ glVertexAttribPointer(textShader_attribute_tex, 2, GL_FLOAT, GL_FALSE, 0, tex);
+ glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+
+ glBindTexture(GL_TEXTURE_2D, Texture::genColor(Color(255,0,0)));
+
+ glVertexAttribPointer(textShader_attribute_coord, 3, GL_FLOAT, GL_FALSE, 0, back);
+ glVertexAttribPointer(textShader_attribute_tex, 2, GL_FLOAT, GL_FALSE, 0, tex);
+ glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+
+ glDisableVertexAttribArray(textShader_attribute_coord);
+ glDisableVertexAttribArray(textShader_attribute_tex);
+
+ glUseProgram(0);
+ }
/*
* Lists all of the quests the player is currently taking.
@@ -1328,16 +1423,36 @@ EXIT:
}
if (fadeWhite)
- safeSetColorA(255, 255, 255, fadeIntensity);
+ glBindTexture(GL_TEXTURE_2D, Texture::genColor(Color(255, 255, 255, fadeIntensity)));
else
- safeSetColorA(0, 0, 0, fadeIntensity);
+ glBindTexture(GL_TEXTURE_2D, Texture::genColor(Color(0, 0, 0, fadeIntensity)));
+
+ GLfloat tex[] = {0.0, 0.0,
+ 1.0, 0.0,
+ 0.0, 1.0,
+ 1.0, 1.0};
+
+ GLfloat backdrop[] = {offset.x - SCREEN_WIDTH / 2, offset.y - SCREEN_HEIGHT / 2, 1.0,
+ offset.x + SCREEN_WIDTH / 2, offset.y - SCREEN_HEIGHT / 2, 1.0,
+ offset.x - SCREEN_WIDTH / 2, offset.y + SCREEN_HEIGHT / 2, 1.0,
+ offset.x + SCREEN_WIDTH / 2, offset.y + SCREEN_HEIGHT / 2, 1.0};
+
+ glUniform1i(textShader_uniform_texture, 0);
+ glUseProgram(textShader);
- glRectf(offset.x - SCREEN_WIDTH / 2,
- offset.y - SCREEN_HEIGHT / 2,
- offset.x + SCREEN_WIDTH / 2,
- offset.y + SCREEN_HEIGHT / 2
- );
- }
+ glEnableVertexAttribArray(textShader_attribute_coord);
+ glEnableVertexAttribArray(textShader_attribute_tex);
+
+ glVertexAttribPointer(textShader_attribute_coord, 3, GL_FLOAT, GL_FALSE, 0, backdrop);
+ glVertexAttribPointer(textShader_attribute_tex, 2, GL_FLOAT, GL_FALSE, 0, tex);
+ glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+
+ glDisableVertexAttribArray(textShader_attribute_coord);
+ glDisableVertexAttribArray(textShader_attribute_tex);
+
+ glUseProgram(0);
+
+ }
void fadeUpdate(void) {
if (fadeEnable) {