• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to fix the graphics of the rubiks cube in javafx

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Marshal
Posts: 79179
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Rancher
Posts: 387
30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is cross-post of:
http://stackoverflow.com/questions/34001900/how-to-fix-the-graphics-of-the-rubiks-cube-in-javafx
The question is answered there.

As an FYI:
https://coderanch.com/how-to/java/BeForthrightWhenCrossPostingToOtherSites
 
Campbell Ritchie
Marshal
Posts: 79179
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
reply
    Bookmark Topic Watch Topic
  • New Topic