If this isn't good enough, I really don't know what is - this was the shortest I could make it:
void welcomescreen()
{
sf::ContextSettings contextSettings;
contextSettings.depthBits = 48;
sf::RenderWindow windowo(sf::VideoMode(640, 480), "gameTest", sf::Style::Default, contextSettings);
windowo.resetGLStates();
windowo.setVerticalSyncEnabled(true);
sf::Font txt;
txt.loadFromFile("resources/armyfont.ttf");
sf::Text wlcmtxt;
wlcmtxt.setFont(txt); //text
wlcmtxt.setScale(1.4, 1.4);
wlcmtxt.setString("gameTest");
wlcmtxt.setOrigin(-130, -0);
windowo.setActive();
glClearDepth(1.f);
glClearColor(0.f, 0.f, 0.f, 1.f);
glEnable(GL_DEPTH_TEST);
glDepthMask(GL_TRUE);
glDisable(GL_LIGHTING);
glDisable(GL_TEXTURE_2D);
glViewport(0, 0, windowo.getSize().x, windowo.getSize().y);
// make 3d cube
GLfloat cube[] =
{
-50, -50, -50, 0, 0, 1, 1,
-50, 50, -50, 0, 0, 1, 1,
-50, -50, 50, 0, 0, 1, 1,
-50, -50, 50, 0, 0, 1, 1,
-50, 50, -50, 0, 0, 1, 1,
-50, 50, 50, 0, 0, 1, 1,
50, -50, -50, 0, 1, 0, 1,
50, 50, -50, 0, 1, 0, 1,
50, -50, 50, 0, 1, 0, 1,
50, -50, 50, 0, 1, 0, 1,
50, 50, -50, 0, 1, 0, 1,
50, 50, 50, 0, 1, 0, 1,
-50, -50, -50, 1, 0, 0, 1,
50, -50, -50, 1, 0, 0, 1,
-50, -50, 50, 1, 0, 0, 1,
-50, -50, 50, 1, 0, 0, 1,
50, -50, -50, 1, 0, 0, 1,
50, -50, 50, 1, 0, 0, 1,
-50, 50, -50, 0, 1, 1, 1,
50, 50, -50, 0, 1, 1, 1,
-50, 50, 50, 0, 1, 1, 1,
-50, 50, 50, 0, 1, 1, 1,
50, 50, -50, 0, 1, 1, 1,
50, 50, 50, 0, 1, 1, 1,
-50, -50, -50, 1, 0, 1, 1,
50, -50, -50, 1, 0, 1, 1,
-50, 50, -50, 1, 0, 1, 1,
-50, 50, -50, 1, 0, 1, 1,
50, -50, -50, 1, 0, 1, 1,
50, 50, -50, 1, 0, 1, 1,
-50, -50, 50, 1, 1, 0, 1,
50, -50, 50, 1, 1, 0, 1,
-50, 50, 50, 1, 1, 0, 1,
-50, 50, 50, 1, 1, 0, 1,
50, -50, 50, 1, 1, 0, 1,
50, 50, 50, 1, 1, 0, 1,
};
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
glVertexPointer(3, GL_FLOAT, 7 * sizeof(GLfloat), cube);
glColorPointer(4, GL_FLOAT, 7 * sizeof(GLfloat), cube + 3);
glDisableClientState(GL_NORMAL_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
while (windowo.isOpen())
{
sf::Event event;
while (windowo.pollEvent(event))
{
if (event.type == sf::Event::Resized)
glViewport(0, 0, event.size.width, event.size.height);
}
glClearColor(1.0, 1.0, 1.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glColor3f(1.0f, 0.0f, 0.0f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.f, 0.f, -200.f);
// Draw the cube
glDrawArrays(GL_TRIANGLE_STRIP, 0, 36);
windowo.pushGLStates();
windowo.draw(wlcmtxt); //Problem
windowo.popGLStates();
windowo.display();
}
}