We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello!
I have a strange bug when using the G4P generated user interface. Sometimes the GUI items change their appearance. Its very hard to explain how it looks. It is probably best to look at the corrupted vs normal comparison GUI images.
I also don't know when and what triggers the corruption. (Looks kind of randomly)
examples: LEFT IMAGE is corrupted RIGHT IMAGE is normal
Maybe @quark could know what it is?
Answers
To be honest I don't think this is a problem with G4P since it has never been reported before, but then I have been wrong before now ;)
Please answer these questions
What version of G4P are you using?
What version of Processing are you using?
What OS and version are you using?
I assume your program is quite large, can you produce a small program that demonstrate this problem?
If the answer to the last question is no, can you archive the sketch (from Tools menu) and put the zip file somewhere I can download it? If you want to keep the code then I can PM my email address to you.
Hey thanks for the reply:
G4P version 3.5 Processing 2.2.1 OS X
The problem is i don't know how to reproduce this corruption, the only thing which may cause the corruption is this error i get:
OpenGL error 1281 at bot endDraw(): invalid value
This might not be caused by G4P I really need to see the code to be sure.
If you archive the sketch causing the problem, you can do this from the Tools menu, then send the zip file to me I will look at it.
I will send my email address by PM
I don't want to bother you with the sketch as it is really big and also requires external hardware.
Fortunately it seems that I found the "black sheep" which triggers the corruption. Can't believe that this 1 line of code does such a mess...
appc.textFont(font, 30*scale);
Example:
I have a text which uses 2 fonts, and I do it in this rendering_draw function (loop). Is there a better way how could i set those 2 fonts?
Thank you for your forever lasting kind help @quark !
I don't see why this should cause the corruption. I tried a simple test below, the slider changes the scale, and couldn't find a problem.
In your method
rendering_draw
do you use anything likeappc.scale(...);
or
control.draw();
where control is some G4P control
Yes I do, the following is the full code from the rendering_draw method:
Make the first line of the method
appc.pushMatrix();
and the last line
appc.popMatrix();
otherwise the
appc.scale(...)
will affect the controls as well.The pop/pushMatrix() doesn't affect the application. If i add your suggestion and uncomment "appc.textFont()" the corruption still occours.
Then I have no idea since I can't replicate your problem. :(
Hmm, do you know a alternative way which i might use insted the textFont() method?
I don't think textFont is the problem in itself because my example worked just fine.
Does FRAME_RATE ever reach zero?
My Sketch is a big Program with 2 windows one uses P2D (controls) and the Second one uses OPENGL (animation).
The rendering_draw(GWinApplet appc, GWinData data) method is the one which belongs to OPENGL.
Maybe you can not reproduce the error because you dont have a combinaton of OPENGL and P2D in your example?
P.S. FRAME_RATE is const 60
I don't know if you will call me crazy or something but I have to explain the solution to the problem;
It looks like that the main issue was with the font:
I generated a font with Processing (Tool ->Create Font) with the size 48. After changing the size to 30 there is no more control corruption.
I still can't believe that this was the issue, but until now the bug didn't occur.
Update:
After more observation I realized that the GUI corruption occours if:
If in the method:
appc.textFont(fontName.vlw,size);
the font size of fontName.vlw is > than size
the font and size of fontName.vlw is generated via Processing tool (Too -> Create Font)
My solution:
appc.textFont(getStableFont(30*scale),30*scale);
where getStableFont() ->
Hope this helps someone in the future.
Thanks to everyone who tried to solve this issue ;)
P.S. The scale parameter is used when resizing the window to scale all objects contained in the window.
Unfortunately this was not the solution, the problem still exists...
I don't believe this is G4P issue.
Since you can't post code that replicates the problem here then the only way I can help further is if you archive the sketch from the Tools menu and make the zip file available to me to download or email it to me.