When I add rotation to the object, or when I tell it to translate when I press a specific button, it just doesn't show up and the object stays the same. It does show up however if I define it in code.
Here's the smaller code as requested by Laurent:
(opengl related stuff)
int InitGL() // All Setup For OpenGL Goes Here
{
glShadeModel(GL_SMOOTH); // Enable Smooth Shading
glClearColor(0.0f, 0.0f, 220.0f, 0.5f); // Black Background
glClearDepth(1.0f); // Depth Buffer Setup
glEnable(GL_DEPTH_TEST); // Enables Depth Testing
glDepthFunc(GL_LEQUAL); // The Type Of Depth Testing To Do
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // Really Nice Perspective Calculations
return true; // Initialization Went OK
}
void ResizeGLScene(int width, int height) // Resize And Initialize The GL Window
{
if (height==0) // Prevent A Divide By Zero By
{
height=1; // Making Height Equal One
}
glViewport(0,0,width,height); // Reset The Current Viewport
glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
glLoadIdentity(); // Reset The Projection Matrix
// Calculate The Aspect Ratio Of The Window
gluPerspective(45.0f,(GLfloat)width/(GLfloat)height,0.1f,1000.0f);
glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
glLoadIdentity(); // Reset The Modelview Matrix
}
float angle = 0.0f;
int DrawGLScene() // Here's Where We Do All The Drawing
{
//glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear Screen And Depth Buffer
glLoadIdentity(); // Reset The Current Modelview Matrix
glTranslatef(0.0f,0.0f,-200.0f);
glRotatef(angle, 0.0f, 0.0f, 1.0f); // Move Left 1.5 Units And Into The Screen 6.0
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();
angle += 0.5f;
if (angle >= 360.f)
angle = 0.0f; // Done Drawing The Quad
return true; // Keep Going
}
sfml drawing, DrawGLScene goes before the following snippet.
if (IsMoving == false)
{
App.pushGLStates();
if (Dir == 0)
{
App.draw(idleUp);
}
else if (Dir == 1)
{
App.draw(idleDown);
}
else if (Dir == 2)
{
App.draw(idleLeft);
}
else if (Dir == 3)
{
App.draw(idleRight);
}
App.popGLStates();
}
else if (IsMoving == true)
{
App.pushGLStates();
if (Dir == 0)
{
App.draw(runningLeft);
}
else if (Dir == 1)
{
App.draw(runningLeft);
}
else if (Dir == 2)
{
App.draw(runningLeft);
}
else if (Dir == 3)
{
App.draw(runningRight);
}
App.popGLStates();
}
No idea what might be causing it because for instance I ported a program from the 1.3 sfml tutorial (rotating cube) to 2.0 sfml and it worked.