1
Graphics / My Text and All Scene Gone ...
« on: August 08, 2008, 04:16:09 am »
Hi, greetings.
I had problem with my code that use sf::string
I want to use it as fps information in my program. My program are OpenGL base. But all my OpenGL scene and the text are gone when I try to draw a text. I don't know what wrong with my program. This is my code
I had problem with my code that use sf::string
I want to use it as fps information in my program. My program are OpenGL base. But all my OpenGL scene and the text are gone when I try to draw a text. I don't know what wrong with my program. This is my code
Code: [Select]
this->appWin = new sf::RenderWindow(sf::VideoMode(width,height,bpp),"Test");
this->appWin->PreserveOpenGLStates(true);
.
.
.
GLuint fps = 0;
GLfloat time_elapsed = 0;
stringstream s;
s << fps;
sf::String fpsStr(s.str());
fpsStr.SetColor(sf::Color::White);
this->initEngine();
while (this->appWin->IsOpened())
{
sf::Event Event;
while (this->appWin->GetEvent(Event))
{
if (Event.Type == sf::Event::Closed)
this->appWin->Close();
if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape))
this->appWin->Close();
}
this->appWin->SetActive();
this->draw();
this->appWin->Draw(fpsStr);
this->appWin->Display();
/*time_elapsed += this->appWin->GetFrameTime();
if (time_elapsed > 1.0f) {
}else {
fps++;
}*/
}