We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOpenGL and 3D Libraries › tearing graphics MacBook Pro
Page Index Toggle Pages: 1
tearing graphics MacBook Pro (Read 958 times)
tearing graphics MacBook Pro
Jul 6th, 2008, 12:24am
 
I am having issues with tearing while rendering though OPENGL.  At first I thought it was processing, but now I see than in an example from the OGRE game engine I am getting the same tearing.  As far as I know OS X doesn't give you access to any graphics cards settings.

The tearing happens even if I am loading a 1024 square image in, which P3D does without a problem.


Anyone have any ideas about how to remedy this.  A smoothly rendered sketch would make for a really AWESOME sketch, so any help is very much appreciated.


Re: tearing graphics MacBook Pro
Reply #1 - Jul 8th, 2008, 7:46am
 
I have found that gl.setSwapInterval(1) fixes the tearing i was experiencing.  This command turns vsync on.

I have two problems now.

1) I now have ghosting.  I want to be able to tell the renderer that the screen should be entirely cleared of one frame before rendering another.  Does anyone have any info on this?  Could ghosting be caused by the use of textures?

2) This is less important, but I would like to know why rendering between pgl.beginGL() and end() causes the graphics to render in smaller portion of the canvas.

Here's my test program with the graphics inside pgl block.

import processing.opengl.*;
import javax.media.opengl.*;

PFont myFont;
float a;
int pressed;
GLCanvas canvas;

void setup() {
 size(800, 600, OPENGL);
 fill(0, 153);
 noStroke();
   myFont = createFont("FFScala", 32);
 textFont(myFont);
}

void draw() {
 //frameRate(200);
 
   PGraphicsOpenGL pgl = (PGraphicsOpenGL) g;  // g may change
   GL gl = pgl.beginGL();  // always use the GL object returned by beginGL

 if (keyPressed == true) {
 gl.setSwapInterval(1);
 gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT );
 } else {
 gl.setSwapInterval(0);
 }
  text(frameRate, 10, 50);
 translate(mouseX-width/2,mouseY-height/2,0);
 translate(width/2, height/2);
 rotateX(a);
 rotateY(a*2);
 rect(-200, -200, 400, 400);
 rotateX(PI/2);
 rect(-200, -200, 400, 400);
 a += 0.01;
 background(255);
 pgl.endGL();
}

Page Index Toggle Pages: 1