Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to fix the graphics of the rubiks cube in javafx

 
Debarun Mukherjee
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was try to make a rubiks cube in javafx an ended up with a very bad model as given in the attatchment . I am giving my source for code for this, where I have used RectangleBuilder class to create rectangles and transformed in 3d. To fix the graphics i had also tried to build the rectangles used TriangleMesh class and after adding materials to them, transformed them in 3d to end up again in the same bad graphics. Why does this occur and how to get rid of it ? Here is my source code,

Capt23ure.PNG
[Thumbnail for Capt23ure.PNG]
The is the graphics that I
 
Campbell Ritchie
Sheriff
Posts: 51419
87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

You have arrived in the wrong place; this forum is for discussing the forum itself. Never, mind, I can move you to the FX forum. I have also had to remove some excess code tags and break some of the long lines which made the code illegible. Please only use the code button to add tags and only around code.

Why have you got so many static fields?
What happens if you create only one cube object? What happens if you only create one side?
 
Debarun Mukherjee
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for editing my question properly and sorry for my mistakes.

The static fields before the handleMouse() method are used to get the current mouse position coordinates which are used in the handleMouse() method to rotate the perspective camera along the x and y axes with the dragging of the mouse so as to get the view of the cube from different angles.

If I display a single cube with the same colour on all the faces its fine, but as i use different colours on the 6 different faces the same problem arises.
 
John Damien Smith
Ranch Hand
Posts: 299
14
 
Campbell Ritchie
Sheriff
Posts: 51419
87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Debarun Mukherjee wrote:. . . The static fields before the handleMouse() method are used to get the current mouse position coordinates . . .
Why are they static?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic