New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with frame.setSize() in P2D/P3D #3223

Closed
StanLepunK opened this Issue Apr 27, 2015 · 1 comment

Comments

Projects
None yet
2 participants
@StanLepunK

StanLepunK commented Apr 27, 2015

I work around the possibility to change the size of the sketch after run it.
But when I use the method setSize, the new width is good, but not the height, it miss 2 pixels.
Plus that's don't work totally in P2D and P3D.
Processing 307 / OSX 10.9

void setup() { 
   size(100, 100); // ok 
   // size(100, 100,P2D); // problem 
   // size(100, 100,P3D); // problem
}

void draw() {
  background(0) ;
  frame.setResizable(false);
  int newWidth =400 ;
  int newHeight =400 ;
  println(newHeight, height) ;
  if(height != newHeight) {
    frame.setResizable(true);
    frame.setSize(newWidth,newHeight);
    println(frameCount) ;
  }
}

@benfry benfry changed the title from Problem with frame.setSize() to Problem with frame.setSize() in P2D/P3D Apr 28, 2015

@StanLepunK

This comment has been minimized.

Show comment
Hide comment
@StanLepunK

StanLepunK Apr 28, 2015

I find this info, may be there is something interesting ?
http://gamedev.stackexchange.com/questions/73561/lwjgl-resize-window-and-gltranslate-breaking-screen-resolution
and
http://stackoverflow.com/questions/17367651/resizing-window-contents-with-lwjgl

And I look in PLWJGL.java to try to understand, but it's a deep coding for me :( I understang nothing !

@Override
public void viewport(int x, int y, int w, int h) {
      float f = Display.getPixelScaleFactor();
      GL11.glViewport((int)(f * x), (int)(f * y), (int)f * w, (int)(f * h));
    }

StanLepunK commented Apr 28, 2015

I find this info, may be there is something interesting ?
http://gamedev.stackexchange.com/questions/73561/lwjgl-resize-window-and-gltranslate-breaking-screen-resolution
and
http://stackoverflow.com/questions/17367651/resizing-window-contents-with-lwjgl

And I look in PLWJGL.java to try to understand, but it's a deep coding for me :( I understang nothing !

@Override
public void viewport(int x, int y, int w, int h) {
      float f = Display.getPixelScaleFactor();
      GL11.glViewport((int)(f * x), (int)(f * y), (int)f * w, (int)(f * h));
    }

JakubValtar added a commit to JakubValtar/processing that referenced this issue Jul 20, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment