Hi everyone, i'm working with tao framework and i trying to make animation for my models from glut libraries but animation with using glut doesn't work (after compiling program closes) :( I tried found exception by try-catch but there are not exceptions. If drawing across vertex that animation will work. Static picture draws. Someone faced with that problem of glut animation ?
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Tao.OpenGl;
using Tao.FreeGlut;
using Tao.Platform.Windows;
namespace WindowsFormsApplication9
{
public partial class Form1 : Form
{
int angle = 100;
public Form1()
{
InitializeComponent();
AnT.InitializeContexts();
Glut.glutTimerFunc(30, timer, 0);
Glut.glutMainLoop();
}
public void timer(int Unused)
{
Glut.glutPostRedisplay();
Glut.glutTimerFunc(30, timer, 0);
}
private void AnT_Load(object sender, EventArgs e)
{
// inizialization Glut
Glut.glutInit();
Glut.glutInitDisplayMode(Glut.GLUT_RGB | Glut.GLUT_DOUBLE | Glut.GLUT_DEPTH);
// clearing window
Gl.glClearColor(255, 255, 255, 1);
Gl.glViewport(0, 0, AnT.Width, AnT.Height);
// setting of projection
Gl.glMatrixMode(Gl.GL_PROJECTION);
Gl.glLoadIdentity();
Glu.gluPerspective(100, (float)AnT.Width / (float)AnT.Height, 0.1, 200);
Gl.glMatrixMode(Gl.GL_MODELVIEW);
Gl.glLoadIdentity();
// setting of parameters OpenGL for visualisation
Gl.glEnable(Gl.GL_DEPTH_TEST);
Gl.glClear(Gl.GL_COLOR_BUFFER_BIT | Gl.GL_DEPTH_BUFFER_BIT);
Gl.glLoadIdentity();
Gl.glColor3f(1.0f, 0, 0);
Gl.glPushMatrix();
Gl.glTranslated(-1, 0, -3);
Gl.glRotated(angle, 0, 1, 0);
Glut.glutWireCylinder(1, 2, 20, 20);
Gl.glPopMatrix();
Glut.glutSwapBuffers();
angle++;
AnT.Invalidate();
}
}
}