System: Windows XP
Compiler/IDE: Lazarus 1.0 for Win32
API: OpenGL
Hey all!
I've been writing a program which basically draws stuff on a LazyOpenGL box. Simple.
Now, however, I would like to improve it and either
- add another form with another LazyOpenGL box
- or simply add another LazyOpenGL box on the same form
which would run simultaneously with the main form but would show other pieces of information.
At the moment, my drawing procedure looks like this:
{code}
procedure TForm1.Timer1Timer(Sender: TObject);
begin
glClearColor(0, 0, 0, 1);
glClear(GL_COLOR_BUFFER_BIT);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
...
// Draw everything
DrawBackground(...);
DrawAxes(...);
DrawDots(...);
// Displaya
OpenGLBox1.SwapBuffers;
end;
{/code}
My problem is that I don't know how to tell which OpenGLBox to draw on when I create a second OpenGLBox on the same form; or how to open a second form at the same time as the first one.
I tried creating a second OpenGLBox and adding OpenGLBox2.SwapBuffers on the last line, but I get a SIGSEV error.
I also tried designing another form, which automatically adds the line
Application.CreateForm(TForm2, Form2);
in the main program
{code}
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.CreateForm(TForm2, Form2);
Application.Run;
end.
{/code}
but the second form never runs.
I also tried
{code}
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
Application.CreateForm(TForm2, Form2);
Application.Run;
end.
{/code}
to see if the second form would run after the first one closes, but it doesnt.
I tried moving the lines
Application.CreateForm(TForm2, Form2);
Application.Run;
to the procedure which runs when the first form is created, but it bugs.
Could anyone please help?
Cheers
Bookmarks