Hello,
my problem is of that kind beginners use to have. After following some glut tutorials I've decided it's time to do something small generally on my own. An obstacle appeared at the very beginning.
At the moment I got stuck, all my code was supposed to do was drawing a primitive using an ortagonal transformation to display it. Apperently, I failed at coding the latter.
void reshape (int w, int h)
{
if (h==0)
{
h=1;
}
glViewport(0,0,w,h);
glMatrixMode (GL_PROJECTION);
glLoadIdentity();
glOrtho(0.0f,w,h,0.0f,-1.0f,1.0f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
and the drawing func("bobby's" variables x and y are holding float values, tried with various bare numbers too):
void DrawScene(void)
{
glPushMatrix();
glTranslatef(bobby.x, bobby.y, 0.0f);
glColor3f(1.0f, 0.0f, 0.0f);
glBegin(GL_TRIANGLES);
glVertex2d(-0.2, -0.2);
glVertex2d(0.2, 0.2);
glVertex2d(0.2, -0.2);
glEnd();
glPopMatrix();
glutSwapBuffers();
}
Guess I could solve this with a little help of an example code, but I'd like to understand what I'm doing. Thanks.