@@ -109,6 +109,49 @@ void renderText(const std::string& fontPath, int fontSize, const std::pair<float
109109 glDeleteTextures (1 , &texture);
110110}
111111
112+ /* *
113+ * Render some text on screen.
114+ *
115+ * @param bottomLeft The bottom left screen coordinate of the bounding box to draw to.
116+ * @param topRight The top right screen coordinate of the bounding box to draw to.
117+ * @param texture The texture of text to render.
118+ */
119+ void renderText (const std::pair<float , float > bottomLeft, const std::pair<float , float > topRight, const GLuint& texture){
120+ glBindTexture (GL_TEXTURE_2D, texture);
121+ glColor3f (1.0 , 1.0 , 1.0 );
122+
123+ glBegin (GL_QUADS);
124+ glTexCoord2i (0 , 1 );
125+ glVertex2f (bottomLeft.first , bottomLeft.second );
126+ glTexCoord2i (1 , 1 );
127+ glVertex2f (topRight.first , bottomLeft.second );
128+ glTexCoord2i (1 , 0 );
129+ glVertex2f (topRight.first , topRight.second );
130+ glTexCoord2i (0 , 0 );
131+ glVertex2f (bottomLeft.first , topRight.second );
132+ glEnd ();
133+ glBindTexture (GL_TEXTURE_2D, 0 );
134+ }
135+
136+ /* *
137+ * Render a colored rectangle on the screen
138+ *
139+ * @param bottomLeft the bottom left corner of the box
140+ * @param topRight the top right corner of the box
141+ * @param color the rgb color percentages of the box
142+ */
143+ void renderRectangle (const std::pair<float , float > bottomLeft, const std::pair<float , float > topRight, const std::tuple<float , float , float > color){
144+ glBindTexture (GL_TEXTURE_2D, 0 );
145+ glColor3f (std::get<0 >(color), std::get<1 >(color), std::get<2 >(color));
146+
147+ glBegin (GL_QUADS);
148+ glVertex2f (bottomLeft.first , bottomLeft.second );
149+ glVertex2f (topRight.first , bottomLeft.second );
150+ glVertex2f (topRight.first , topRight.second );
151+ glVertex2f (bottomLeft.first , topRight.second );
152+ glEnd ();
153+ }
154+
112155/* *
113156 * Loads an image into an OpenGL texture.
114157 * @param name The file name of the texture to load.
0 commit comments