I want to render a simple OpenGL scene as usual, but then I want to superimpose a small image of my own (such as from a bitmap file) on top of the render, such that this image always shows. For example, this could be thought of as showing a logo in the corner of the screen for a 3D game, where the logo is always displayed on top of the rendered scene.
Please could somebody start me off in the right direction? What should I be looking into? I am rather a novice at OpenGL...
Let us suppose that I have the following code:
#include <GL/glut.h>
void renderScene(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glBegin(GL_TRIANGLES);
glVertex3f(-0.5,-0.5,0.0);
glVertex3f(0.5,0.0,0.0);
glVertex3f(0.0,0.5,0.0);
glEnd();
glutSwapBuffers();
}
int main(int argc, char **argv)
{
// init GLUT and create Window
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);
glutInitWindowPosition(100,100);
glutInitWindowSize(320,320);
glutCreateWindow("GLUT Triangles");
// register callbacks
glutDisplayFunc(renderScene);
// enter GLUT event processing cycle
glutMainLoop();
return 1;
}
This renders a triangle on the screen. How, for example, would I now render a 10-by-10 bitmap from file, at location (100, 100) on the screen? If the viewpoint was static, I could just calculate its 3D location and render it. However, I want the bitmap image to always be displayed in this location, even when the viewpoint changes.
Thanks :)
such as superimposing a small image on the screen, on top of the rendered image
Easiest way is to just draw a quad with needed image after other objects. \$\endgroup\$ – HolyBlackCat May 5 '15 at 19:55