glClearColor引发了异常TOpenGLComponent Lazarus

时间:2016-12-08 14:24:59

标签: opengl lazarus freepascal openglcontext

我使用Lazarus(在Linux下)请有人帮助我。我有问题。我已经安装了LasOpenGLContext。组件面板上有“OpenGL Controll”。我想绘制一个简单的立方体。但我不能这样做。我得到public class CustomTestSystemFactory implements TestSystemFactory { private final SlimTableFactory slimTableFactory; private final CustomComparatorRegistry customComparatorRegistry; public CustomTestSystemFactory(SlimTableFactory slimTableFactory, CustomComparatorRegistry customComparatorRegistry) { this.slimTableFactory = slimTableFactory; this.customComparatorRegistry = customComparatorRegistry; } public final TestSystem create(Descriptor descriptor) throws IOException { SlimClientBuilder clientBuilder = new CustomClientBuilder(descriptor); SlimCommandRunningClient slimClient = clientBuilder.build(); HtmlSlimTestSystem testSystem = new HtmlSlimTestSystem(clientBuilder.getTestSystemName(), slimClient, this.slimTableFactory.copy(), this.customComparatorRegistry); return testSystem; } } 出了什么问题?请,如果有任何想法。

raised an exception class 'External:SIGSEGV'

1 个答案:

答案 0 :(得分:0)

您似乎错过了OpenGL上下文创建。没有它,每个OpenGL调用都可能导致程序崩溃。我还没有使用Lazarus,但根据their website,创建上下文的代码可能如下:

procedure TForm1.FormCreate(Sender: TObject);
begin
  GLbox:= TOpenGLControl.Create(Form1);
  GLbox.AutoResizeViewport:= true;
  GLBox.Parent := self;
  GLBox.MultiSampling:= 4;
  GLBox.Align := alClient;
  GLBox.OnPaint := @GLboxPaint; //for "mode delphi" this would be "GLBox.OnPaint := GLboxPaint"
  GLBox.invalidate;
end;