Hello guys!
I've been off for some time during this summer, to make some decisions to what i'll do when i start off school,
and also decided to make some changes to my way of programming, and what i'll use for it.
So after all this thinking and decision taking (i know it's very dangerous.. but hopefully we all live right?
)
i decided to learn some more stuff in sfml and opengl (which i'll be using for future projects).
i started the opengl sfml tutorial, i adapted the code to sfml2.0 but i get a very darn stupid error while compiling/debugging..
#include <SFML/Window.hpp>
#include <GL/gl.h>
#include <GL/glu.h>
int main()
{
// Create the main window
sf::Window App(sf::VideoMode(800, 600, 32), "SFML OpenGL");
// Create a clock for measuring time elapsed
sf::Clock Clock;
// Set color and depth clear value
glClearDepth(1.f);
glClearColor(0.f, 0.f, 0.f, 0.f);
// Enable Z-buffer read and write
glEnable(GL_DEPTH_TEST);
glDepthMask(GL_TRUE);
// Setup a perspective projection
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(90.f, 1.f, 1.f, 500.f);
// Start game loop
while (App.isOpen())
{
// Process events
sf::Event Event;
while (App.pollEvent(Event))
{
// Close window : exit
if (Event.type == sf::Event::Closed)
App.close();
// Escape key : exit
if ((Event.type == sf::Event::KeyPressed) && (Event.key.code == sf::Keyboard::Escape))
App.close();
// Resize event : adjust viewport
if (Event.type == sf::Event::Resized)
glViewport(0, 0, Event.size.width, Event.size.height);
}
// Set the active window before using OpenGL commands
// It's useless here because active window is always the same,
// but don't forget it if you use multiple windows or controls
App.setActive();
// Clear color and depth buffer
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// Apply some transformations
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.f, 0.f, -200.f);
glRotatef(Clock.getElapsedTime(); * 50, 0.0f, 0.0f, 0.0f); //<---- Here mapsy mapsy..
glRotatef(Clock.getElapsedTime(); * 30, 0.f, 0.f, 0.f);
glRotatef(Clock.getElapsedTime(); * 90, 0.f, 0.f, 0.f);
// Draw a cube
glBegin(GL_QUADS);
glVertex3f(-50.f, -50.f, -50.f);
glVertex3f(-50.f, 50.f, -50.f);
glVertex3f( 50.f, 50.f, -50.f);
glVertex3f( 50.f, -50.f, -50.f);
glVertex3f(-50.f, -50.f, 50.f);
glVertex3f(-50.f, 50.f, 50.f);
glVertex3f( 50.f, 50.f, 50.f);
glVertex3f( 50.f, -50.f, 50.f);
glVertex3f(-50.f, -50.f, -50.f);
glVertex3f(-50.f, 50.f, -50.f);
glVertex3f(-50.f, 50.f, 50.f);
glVertex3f(-50.f, -50.f, 50.f);
glVertex3f(50.f, -50.f, -50.f);
glVertex3f(50.f, 50.f, -50.f);
glVertex3f(50.f, 50.f, 50.f);
glVertex3f(50.f, -50.f, 50.f);
glVertex3f(-50.f, -50.f, 50.f);
glVertex3f(-50.f, -50.f, -50.f);
glVertex3f( 50.f, -50.f, -50.f);
glVertex3f( 50.f, -50.f, 50.f);
glVertex3f(-50.f, 50.f, 50.f);
glVertex3f(-50.f, 50.f, -50.f);
glVertex3f( 50.f, 50.f, -50.f);
glVertex3f( 50.f, 50.f, 50.f);
glEnd();
// Finally, display rendered frame on screen
App.display();
}
return EXIT_SUCCESS;
}
the error point is with an arrow in the code.
error:
error: ambiguous overload for 'operator*' in 'Clock.sf::Clock::getElapsedTime() * 50'|
.... any solutions??
i'll check the post after gym
(arround 20:00)
thanks in advance!
~Zeneus