I am new to programming, especially for full applications. However, I have managed to get something working in Processing for my research. However, I am looking to make the application easier to use and was thinking that a more traditional GUI (in comparison to controlP5 that I am using right now) might be better. So I am wondering if it is possible to have my processing sketch (which loads a 3D model that I can manipulate using proscene) appear inside a Qt GUI with menus and toolbars?
I am trying to make my application resizable. So I have put in: frame.setResizable(true);
Up to this point everything is okay. However, I am using controlP5 components which are defined as a class and created in setup by: guiInterface = new GUI(this);
When I resize, the texts from the components goes white and the location of components remains where it was before. So I was thinking that by detecting when there is a change in the window size I could simply recreate the interface based on the new window dimensions. Here is what I put into setup():
frame.addComponentListener(new ComponentAdapter() { public void componentResized(ComponentEvent e) { if(e.getSource()==frame) { guiInterface = null; guiInterface = new GUI(mainApp); } } });
This however, doesn't recreate the GUI components. What do I need to do to get it to recreate/redraw the objects?
Well I am trying to setup some radio buttons to allow some preset views of my model (e.g. top, right, left, etc.). I have managed to get all the views to work except one, the back/rear view. Here is what I have for the others:
I've set up a 3D model using P3D and have been trying unsuccessfully to add some gui controls using controlp5 to the sketch to manipulate the sketch. It appears that controlp5 doesn't get along with P3D very much and that's why it renders the texts very badly. I've tested the setup and it seems that by switching to opengl this issue is resolved.
However, upon switching to opengl, now my sketch is just unbearably slow and unusable. You can see the performance difference by just changing the render engine from opengl to p3d.
I have posted my entire sketch plus two data files you need to work with it
here if anyone wants to take a look. There is a ".dat" file which you are asked to load first. And then there is a ".out" file that you need to load after.
I hope someone can tell me what I'm doing wrong with opengl because I just don't think there should be this much difference between the two! Just for reference I am using Processing 1.5.1.
I am trying to use controlP5 components in P3D mode with proscene. I have the been able to draw the components to the screen with scene.beginScreenDrawing();
The problem I have now is that the labels look awful. They are not legible at all.
I have tried the method suggested
here by Amnon. However, this doesn't work with Accordion components as once they are opened, they stay on the screen. Plus the transparency of the background no longer works.
I've tried using custom control fonts thinking that might solve the problem but when I use the custom fonts, the labels don't even show. Here is what I've got:
ControlFont cFont;
PFont pFont = createFont("Calibri",12,true);
cFont = new ControlFont(pFont);
cp5 = new ControlP5(this); cp5.disableShortcuts(); Group g1 = cp5.addGroup("Inputs") .setBackgroundColor(color(0, 64)) .setBackgroundHeight(150);
I've been developing an application for view some analysis results. The latest part of the development is discussed here:
http://forum.processing.org/topic/create-transparent-png-from-p3d-render. I have been using PeasyCam and it has worked well. However, I am now trying to allow for both perspective and orthographic rendering and it seems the proscene is a more full-featured library that implements so many things that have to do with the camera controls. So I am making a switch. I'm having a lot of difficulties understanding the structure, but I've managed to get the scene working the way I need at the moment.
The issue that is causing me problem at the moment is how to keep the scene/camera fixed while I am dragging a controlP5 slider. In PeasyCam, whenever I press the 'f' key I just assign null handlers to the camera pan, rotate and zoom handlers and then just manipulate the slider. In proscene I am lost. What I want is for proscene to recognize I am using the GUI element and don't interpret mouse drags as rotations. I would love it if I didn't have to freeze the scene everytime I wanted to move the slider, but if that's what I have to do that will work as well.
Hopefully this makes sense. Please tell me if I need to clarify something.
I've set up a 3D model and now I would like to export images from the model in transparent png form (that is the background to be transparent). I have read many blogs and posts here and there but I can't figure out how to make this work.
I've tried Amnon's approach (
http://amnonp5.wordpress.com/2012/01/28/25-life-saving-tips-for-processing/) but it apparently doesn't work for P3D. I get an error saying “isRecording(), or this particular variation of it, is not available with this renderer.” This would have been perfect as it wouldn't mess with the code in draw.
Now I am trying to figure out how to create the PGraphics object and draw to it (I think this is what I'm supposed to do) in the draw loop which still keeping everything working with PeasyCam. I'm just not sure how I need to do this.
I have posted my entire sketch plus two data files you need to work with it
here. There is a ".dat" file which you are asked to load first. And then there is a ".out" file that you need to load after.
I am trying to create a plot of a model (of a temple) and I am using peasycam for camera control. I want to add the three coordinate axis/arrows in the bottom left corner of the screen and have them follow the direction of the camera.
I have more or less succeeded in doing this by using beginHUD() and endHUD(). However, I am having a hard time trying to get the axis to plot in ortho (parallel projection) mode while the rest of the model remains in perspective. As you might imagine having the axis shown in perspective would confuse the user.
Here is my plot code:
float[] rot = pCamera.getRotations();
ortho();
pCamera.beginHUD();
pushMatrix();
translate(60, height - 60, 0);
rotateX(rot[0]);
rotateY(rot[1]);
rotateZ(rot[2]);
strokeWeight(3);
//x-axis
stroke(0, 255, 0);
line(0, 0, 0, 30, 0, 0);
//y-axis
stroke(255, 0, 0);
line(0, 0, 0, 0, 30, 0);
//z-axis
stroke(0, 0, 255);
line(0, 0, 0, 0, 0, -30);
popMatrix();
pCamera.endHUD();
perspective();
Any help is greatly appreciated.
Thanks,
Ali
PS: I had posted this question in the programming section but that was moved into general discussions. This had come up in the course of the thread and there was no solutions. So I am re-posting this particular question here in the hopes that I'll get more input. I hope that is alright with everyone.
I know this question has been asked a number of times, but I have not yet found a conclusive answer. From all available evidence, it is common knowledge that processing uses a left-handed coordinate system. Just to make sure everyone knows what I'm talking about: if you point your left thumb in the x-direction and your index/pointer finger in the y-direction, your middle finger will point to the z-direction. So in this case x-direction is to right, y-direction is downward and z-direction is a outward.
However, for my project, I need the coordinate system to be right-handed. This is so I can maintain consistency with other software that produce the 3D model I use and the analysis software which produces the results I would like to visualize (I have posted about this project
here). I am doing some transformations of the input data and I don't want to deal with a different coordinate system (I am having issues understanding what I'm doing in the normal system).
I understand that there is no direct method of changing the coordinate system. I am just wondering if there is an indirect method which is simple and does not mess up my matrix operations.
I'm a structural engineering master student work on a seismic evaluation of a temple structure in Portugal. For the evaluation, I have created a 3D block model of the structure and will use a discrete element code to analyze the behaviour of the structure under a variety of seismic (earthquake) records. The software that I will use for the analysis has the ability to produce snapshots of the structure at regular intervals which can then be put together to make a movie of the response. However, producing the images slows down the analysis. Furthermore, since the pictures are 2D images from a specified angle, there is no possibility to rotate and view the response from other angles without re-running the model (a process that would take 3 days of computer time).
I am now looking for an alternative method for creating a movie of the response of the structure. What I want is a very lightweight solution, where I can just bring in the block model which I have and then produce the animation by feeding in the location and the three principal axis of each block at regular intervals to produce the animation on the fly. The blocks are described as prisms with the top and bottom planes defining all of the vertices. Since the model is produced as text files, I can modify the output so that it can be read and understood by the animation code. The model is composed of about 180 blocks with 24 vertices per block (so 4320 vertices). The location and three unit vectors describing the block axis are produced by the program and I can write them out in a way that I want.
The main issue is that the quality of the animation should be decent. If the system is vector based and allows for scaling, that would be great. I would like to be able to rotate the model in real time with simple mouse dragging without too much lag or other issues.
I have seen processing used for some amazing things. I don't have any experience with it but I am willing to learn it if it is the right tool for this purpose. I have very limited time (in fact I am already very behind). That is why I wanted to ask the experts here so that I don't waste my time on something that will not work in the end.
I would be very thankful if some of the more experienced users could share their insight about this project and point me in the right direction. I am not sure if this is appropriate, but if you feel that there is another program or approach that is more appropriate for this task, I would love to hear about that as well.