Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2009-08

opengl and compiz

7 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Andrea Mauri

Dear all,
I saw that the bug ID 0011740 (OpenGLControl stutters with Compiz enabled ) is solved. Anyway I still encounter some problems using opengl when compiz is enabled.
I don't know if it is related to the previous bug. Running the pick demo of GLScene now I don't see flickering anymore but if I minimize the pick form and then I restore it the opengl scene disappearas. Regards,
Andrea

Reply by email

Andrea Mauri
to Andrea Mauri

sorry I forgot to mention:
Lazarus 0.9.27 r21258M FPC 2.2.4 i386-linux-gtk 2 (beta) Ubuntu Jaunty
andrea

Andrea Mauri ha scritto:

Show quoted text 15 lines
Dear all, I saw that the bug ID 0011740 (OpenGLControl stutters with Compiz enabled ) is solved. Anyway I still encounter some problems using opengl when compiz is enabled. I don't know if it is related to the previous bug. Running the pick demo of GLScene now I don't see flickering anymore but if I minimize the pick form and then I restore it the opengl scene disappearas. Regards, Andrea -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Mattias Gaertner
to Andrea Mauri: I saw that the bug ID 0011740 (OpenGLControl stutters with Compiz enabled ) is solved.…
Show quoted text 7 lines
Dear all, I saw that the bug ID 0011740 (OpenGLControl stutters with Compiz enabled ) is solved. Anyway I still encounter some problems using opengl when compiz is enabled. I don't know if it is related to the previous bug. Running the pick demo of GLScene now I don't see flickering anymore but if I minimize the pick form and then I restore it the opengl scene disappearas.

I doubt that this is related. The bug was too many queries. This seems more as if an size event is ignored.
Have you asked the glscene developers?

Mattias

Reply by email

Andrea Mauri
to Mattias Gaertner

Dear Mattias,
I think that is related to how lazarus manage opengl. I tried another example with TOpenGLControl and I get the same behaviour. I put a TOpenGLControl on a form then I just copied a piece of code (from the example on TOpenGLControl in Components/Examples) in order to draw a cube after a click on the TOpenGLControl.
When I click on the OpenGLControl1 the cube is correctly painted both with and without compiz.
With compiz disabled if I minimize the form and then restore it the OpenGLControl1 is not visible but if I click on it the OpenGLControl1 appears again and the cube too.
With Compiz enabled if I minimize the form and then restore it the OpenGLControl1 is not visible neither if I click on it the OpenGLControl1 again. Oviously the cube is not visible. Any ideas?
andrea

Here the code I used.

unit Unit1;
{$mode objfpc}{$H+}
interface

uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,

  OpenGLContext, GL, GLU;
type
  { TForm1 }
  TForm1 = class(TForm)
    OpenGLControl1: TOpenGLControl;
    procedure OpenGLControl1Click(Sender: TObject);
  private
    { private declarations }
  public
    { public declarations }
    cube_rotationx: GLFloat;
    cube_rotationy: GLFloat;
    cube_rotationz: GLFloat;
  end;
var
  Form1: TForm1;
implementation

{ TForm1 }

procedure TForm1.OpenGLControl1Click(Sender: TObject);
var
  Speed: Double;
begin
  if Sender=nil then ;
  glClearColor(1.0, 1.0, 1.0, 1.0);
  glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);
  glEnable(GL_DEPTH_TEST);
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  gluPerspective(45.0, double(width) / height, 0.1, 100.0);
  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();
  glTranslatef(0.0, 0.0,-6.0);
  glRotatef(cube_rotationx, cube_rotationy, cube_rotationz, 0.0);
  glBegin(GL_QUADS);
          glColor3f(0.0,1.0,0.0);                              // Set
The Color To Green
          glVertex3f( 1.0, 1.0,-1.0);                  // Top Right Of
The Quad (Top)
          glVertex3f(-1.0, 1.0,-1.0);                  // Top Left Of
The Quad (Top)
          glVertex3f(-1.0, 1.0, 1.0);                  // Bottom Left Of
The Quad (Top)
          glVertex3f( 1.0, 1.0, 1.0);                  // Bottom Right
Of The Quad (Top)
  glEnd();
  glBegin(GL_QUADS);
          glColor3f(1.0,0.5,0.0);                              // Set
The Color To Orange
          glVertex3f( 1.0,-1.0, 1.0);                  // Top Right Of
The Quad (Bottom)
          glVertex3f(-1.0,-1.0, 1.0);                  // Top Left Of
The Quad (Bottom)
          glVertex3f(-1.0,-1.0,-1.0);                  // Bottom Left Of
The Quad (Bottom)
          glVertex3f( 1.0,-1.0,-1.0);                  // Bottom Right
Of The Quad (Bottom)
  glEnd();
  glBegin(GL_QUADS);
          glColor3f(1.0,0.0,0.0);                              // Set
The Color To Red
          glVertex3f( 1.0, 1.0, 1.0);                  // Top Right Of
The Quad (Front)
          glVertex3f(-1.0, 1.0, 1.0);                  // Top Left Of
The Quad (Front)
          glVertex3f(-1.0,-1.0, 1.0);                  // Bottom Left Of
The Quad (Front)
          glVertex3f( 1.0,-1.0, 1.0);                  // Bottom Right
Of The Quad (Front)
  glEnd();
  glBegin(GL_QUADS);
          glColor3f(1.0,1.0,0.0);                              // Set
The Color To Yellow
          glVertex3f( 1.0,-1.0,-1.0);                  // Bottom Left Of
The Quad (Back)
          glVertex3f(-1.0,-1.0,-1.0);                  // Bottom Right
Of The Quad (Back)
          glVertex3f(-1.0, 1.0,-1.0);                  // Top Right Of
The Quad (Back)
          glVertex3f( 1.0, 1.0,-1.0);                  // Top Left Of
The Quad (Back)
  glEnd();
  glBegin(GL_QUADS);
          glColor3f(0.0,0.0,1.0);                              // Set
The Color To Blue
          glVertex3f(-1.0, 1.0, 1.0);                  // Top Right Of
The Quad (Left)
          glVertex3f(-1.0, 1.0,-1.0);                  // Top Left Of
The Quad (Left)
          glVertex3f(-1.0,-1.0,-1.0);                  // Bottom Left Of
The Quad (Left)
          glVertex3f(-1.0,-1.0, 1.0);                  // Bottom Right
Of The Quad (Left)
  glEnd();
  glBegin(GL_QUADS);
          glColor3f(1.0,0.0,1.0);                              // Set
The Color To Violet
          glVertex3f( 1.0, 1.0,-1.0);                  // Top Right Of
The Quad (Right)
          glVertex3f( 1.0, 1.0, 1.0);                  // Top Left Of
The Quad (Right)
          glVertex3f( 1.0,-1.0, 1.0);                  // Bottom Left Of
The Quad (Right)
          glVertex3f( 1.0,-1.0,-1.0);                  // Bottom Right
Of The Quad (Right)
  glEnd();
  Speed := double(OpenGLControl1.FrameDiffTimeInMSecs)/10;
  cube_rotationx += 5.15 * Speed;
  cube_rotationy += 5.15 * Speed;
  cube_rotationz += 20.0 * Speed;
  OpenGLControl1.SwapBuffers;
end;
initialization
  {$I unit1.lrs}
end.
Show quoted text 13 lines
I doubt that this is related. The bug was too many queries. This seems more as if an size event is ignored. Have you asked the glscene developers? Mattias -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Dr. Andrea Mauri, PhD Milano Chemometrics and QSAR Research Group Department of Environmental Sciences University of Milano-Bicocca P.zza della Scienza, 1 20126 Milano - Italy Tel: ++39 02 64482801 mailto: http://michem.disat.unimib.it/chm/

Reply by email

Reimar Grabowski
to Andrea Mauri
Dear Mattias, I think that is related to how lazarus manage opengl.

I cannot really confirm this. My code works fine with or without compiz. But I must admit that I see the same resize problems you do when I use a complex offscreen framebuffer structure with compiz enabled. I did not have the time to trace the origin of the troubles but I don't think it is related to Lazarus (although it is possible). Simple framebuffer setups don't show any problems but I always use the resize event to correctly setup projection matrix and viewport.

I tried another example with TOpenGLControl and I get the same behaviour.

I have just tested your code and it looks like there is a problem with the OnClick event of the control. Lots of clicks are 'lost' if compiz is enabled. But it does not seem to be a problem with the minimizing else my code should show the problem, too, and I can get your code the show the cube even after minimizing and restoring the window. If I find some time I will try to look a little bit deeper.

Any ideas?

Perhaps your driver/card don't play nicely with compiz. Compiz sometimes shows problems with all kind of stuff (mostly task bars and window decorations). So I advise you to disable it while developing or using windowed OpenGL programs (btw fusion-icon makes this window manager switching easy). It may be a problem with GLScene but the 'lost' OnClick events look like there is some trouble with Lazarus, too.

hih

Reimar

P.S.: And while we are talking about compiz issues. I have observed that my framerate increases if I have the mouse pointer over the OpenGLControl (which I think is really strange behaviour). Do you see the same effect?

A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing in e-mail?

Reply by email

Aleš Katona
to Reimar Grabowski

Compiz/linux currently is very touchy depending on your card, kernel and distro (xorg version).

If you have say Ubuntu 9.04 with kernel .28 and the new xorg and you have intel or ati (pre r500, no longer officialy fglrx driver supported) cards you're pretty much screwed when it comes to openGL. Compiz itself works, but opengl is only up to 1.3 version and has bugged compozing (due to kernel mode setting not being in the kernel yet).

All this should change in .30 and .31 kernels and with latest drivers and xorg, although I wouldn't hold my breath for openGL 2.0 functionality (on the bright side, these changes they are making will be great for all the OSS 3d drivers).

It's one of those big OSS overhauls. So atm. if openGL is fishy and you don't have closed source drivers, don't fuss about it much :)

Ales

P.S: for more info, see the phoronix forums and articles

Reply by email

Andrea Mauri
to Aleš Katona

thanks to all. i have an ati video card that causes me a lot of problems with my linux box.
anyway i will disable compiz (i don't like it, i used it just for testing my app).
regards,
andrea

Ale? Katona ha scritto:

Show quoted text 19 lines
Compiz/linux currently is very touchy depending on your card, kernel and distro (xorg version). If you have say Ubuntu 9.04 with kernel .28 and the new xorg and you have intel or ati (pre r500, no longer officialy fglrx driver supported) cards you're pretty much screwed when it comes to openGL. Compiz itself works, but opengl is only up to 1.3 version and has bugged compozing (due to kernel mode setting not being in the kernel yet). All this should change in .30 and .31 kernels and with latest drivers and xorg, although I wouldn't hold my breath for openGL 2.0 functionality (on the bright side, these changes they are making will be great for all the OSS 3d drivers). It's one of those big OSS overhauls. So atm. if openGL is fishy and you don't have closed source drivers, don't fuss about it much :) Ales P.S: for more info, see the phoronix forums and articles -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Dr. Andrea Mauri, PhD Milano Chemometrics and QSAR Research Group Department of Environmental Sciences University of Milano-Bicocca P.zza della Scienza, 1 20126 Milano - Italy Tel: ++39 02 64482801 mailto: http://michem.disat.unimib.it/chm/

Reply by email