Answer the question
In order to leave comments, you need to log in
How to use TaoFramework without WindowsForm?
How to use TaoFramework without winform, that is, not using SimpleGLControl, but by initializing the window through Glut, as is done in pure C ++.
I tried to create an empty project, change the output type to a windows application (so that the console does not appear), and write code like in C ++, but the window is created, with the specified name, but a white square appears, first a white square appears on the entire window, and when resizing the window, it is clear that it is not for the entire window, and if you further resize it, it is gradually destroyed.
Here is the code I wrote:
using System;
using Tao.FreeGlut;
using Tao.OpenGl;
namespace CZ
{
class Game
{
static void Main(string[] argv)
{
Game game = new Game();
Glut.glutInit();
Glut.glutInitDisplayMode(Glut.GLUT_DOUBLE | Glut.GLUT_RGB | Glut.GLUT_DEPTH);
Glut.glutDisplayFunc(game.DisplayFunc);
Glut.glutReshapeFunc(game.ReshapeFunc);
Glut.glutCreateWindow("Test");
Glut.glutMainLoop();
Gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
}
private void DisplayFunc()
{
Gl.glClear(Gl.GL_COLOR_BUFFER_BIT | Gl.GL_DEPTH_BUFFER_BIT);
Gl.glFlush();
}
private void ReshapeFunc(int w, int h)
{
Gl.glViewport(0, 0, w, h);
Gl.glMatrixMode(Gl.GL_PROJECTION);
Gl.glLoadIdentity();
if ((float)w <= (float)h)
{
Glu.gluOrtho2D(0.0, 30.0 * (float)h / (float)w, 0.0, 30.0);
}
else
{
Glu.gluOrtho2D(0.0, 30.0 * (float)w / (float)h, 0.0, 30.0);
}
Gl.glMatrixMode(Gl.GL_MODELVIEW);
Gl.glLoadIdentity();
}
}
}
Answer the question
In order to leave comments, you need to log in
Tao comes with a large number of examples of how to use it. It has just what you are looking for. In this path: \Program Files\TaoFramework\source\examples\ , see examples from the NeHe or FreeGlut folder . They don't use this SimpleGLControl.
Among other examples, you can also find a lot of useful.
Compiled examples can be found here: \Program Files\TaoFramework\examples\
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question