text + OpenGL + window resize = fucked up text
in
Core Library Questions
•
2 years ago
hi,
I have a problem with text in combination with using opengl and resizing the window.
everything looks like it should until I resize the window -- afterwards all the glyphs are just white rectangles.
I'd like to change that, but don't know how. the code below is the result of copy and pasting stuff from different sources, so maybe there is something I'm not aware of.
thanks a lot in advance!
- import java.awt.event.*;
- import controlP5.*;
- import processing.opengl.*;
- import javax.media.opengl.*;
- ControlP5 controlP5;
- int x0, y0;
- void setup() {
- frame.setResizable(true);
- size(1500, 800, OPENGL);
- frameRate(30);
- x0 = width / 2;
- y0 = height / 2;
- frame.addComponentListener(new ComponentAdapter() {
- public void componentResized(ComponentEvent e) {
- if (e.getSource()==frame) {
- frame.setSize(frame.getWidth(), frame.getHeight());
- x0 = frame.getWidth() / 2;
- y0 = frame.getHeight() / 2;
- }
- }
- }
- );
- noSmooth();
- hint(ENABLE_OPENGL_4X_SMOOTH);
- controlP5 = new ControlP5(this);
- controlP5.setAutoDraw(false);
- controlP5.addButton("button",10,100,80,80,20);
- }
- void draw() {
- //hint(ENABLE_NATIVE_FONTS);
- //textMode(SCREEN);
- background(200);
- hint(ENABLE_DEPTH_TEST);
- pushMatrix();
- fill(255);
- ellipse(x0, y0, 100, 100);
- popMatrix();
- hint(DISABLE_DEPTH_TEST);
- controlP5.draw();
- }
1