Java8 3D: weird mesh display

Hi all, I have a strange trouble with the TriangleMesh. I've done an example to display what is weird, see below. It displays a mesh which represents bumps. When the camera rotates (or the mesh - same issue), the vertices which are supposed to be back seem to come front!
The bumps are colored the following way: white is front, black is back (white->red->yellow->green->blue->black). Following the white bumps will be ok until the moment where they go backside and the black holes (in the sky) come front.
What is wrong????
public final class Waves3D extends Application {
  * 3D CONSTRUCTION
  private float[] getPoints(final int width, final int height) {
  final float[] points = new float[width * height * 3];
  final int horizontal = (int) Math.round(Math.ceil((double) width / 2));
  final int vertical = (int) Math.round(Math.ceil((double) height / 2));
  int index = 0;
  for (int y = -height / 2; y < vertical; ++y) {
  for (int x = -width / 2; x < horizontal; ++x) {
  points[index] = x;
  points[++index] = y;
  index += 2; // z value is 0
  return points;
  private float[] getTexCoords(final int width, final int height) {
  final float[] coords = new float[width * height * 2];
  final float[] cache = new float[width];
  final int horizontal = width - 1;
  final int vertical = height - 1;
  int index = 0;
  for (int x = 0; x < width; ++x) {
  cache[x] = (float) x / horizontal;
  for (int y = 0; y < height; ++y) {
  final float percent = (float) y / vertical;
  for (int x = 0; x < width; ++x) {
  coords[index++] = cache[x];
  coords[index++] = percent;
  return coords;
  private int[] getFaces(final int width, final int height) {
  final int horizontal = width - 1;
  final int vertical = height - 1;
  final int[] faces = new int[horizontal * vertical * 2 * 3 * 2];
  int point = 0;
  int index = 0;
  for (int y = 0; y < vertical; ++y) {
  for (int x = 0; x < horizontal; ++x) {
  final int right = point + 1;
  final int down = point + width;
  final int downright = down + 1;
  faces[index++] = point;
  faces[index++] = point;
  faces[index++] = down;
  faces[index++] = down;
  faces[index++] = right;
  faces[index++] = right;
  faces[index++] = right;
  faces[index++] = right;
  faces[index++] = down;
  faces[index++] = down;
  faces[index++] = downright;
  faces[index++] = downright;
  ++point;
  ++point;
  return faces;
  private PhongMaterial getMaterial(final int width, final int height) {
  final PhongMaterial material = new PhongMaterial();
  material.setDiffuseMap(new WritableImage(width, height));
  return material;
  * SAMPLE MESH
  private static final NavigableMap<Float, Color> COLORS = new TreeMap<>();
  static {
  COLORS.put(0f, Color.BLACK);
  COLORS.put(30f, Color.BLUE);
  COLORS.put(60f, Color.GREEN);
  COLORS.put(90f, Color.YELLOW);
  COLORS.put(120f, Color.RED);
  COLORS.put(150f, Color.WHITE);
  private Color getColor(final float level) {
  return COLORS.floorEntry(level).getValue();
  private void fillValues(final PhongMaterial material, final float[] points, final int width, final int height) {
  final WritableImage image = (WritableImage) material.getDiffuseMap();
  final PixelWriter writer = image.getPixelWriter();
  int index = 2;
  for (int y = 0; y < height; ++y) {
  for (int x = 0; x < width; ++x) {
  final float z = ((float) (Math.cos(x / 20.) * Math.sin(y / 20.)) + 1) * 90;
  writer.setColor(x, y, getColor(z));
  points[index] = z;
  index += 3;
  * WINDOW AND SCENE SETUP
  private int a, i;
  private void go(final Stage stage, final int width, final int height) {
  final TriangleMesh mesh = new TriangleMesh();
  final MeshView view = new MeshView(mesh);
  final AnchorPane pane = new AnchorPane();
  final Scene scene = new Scene(pane);
  final ParallelCamera camera = new ParallelCamera();
  final PhongMaterial material = getMaterial(width, height);
  final float[] points = getPoints(width, height);
  fillValues(material, points, width, height);
  mesh.getPoints().addAll(points);
  mesh.getTexCoords().addAll(getTexCoords(width, height));
  mesh.getFaces().addAll(getFaces(width, height));
  view.setMouseTransparent(true);
  view.setCullFace(CullFace.NONE);
  view.setMaterial(material);
  AnchorPane.setLeftAnchor(view, 0d);
  AnchorPane.setRightAnchor(view, 0d);
  AnchorPane.setTopAnchor(view, 0d);
  AnchorPane.setBottomAnchor(view, 0d);
  pane.getChildren().addAll(camera, view);
  scene.setCamera(camera);
  stage.setScene(scene);
  stage.show();
  new Thread(() -> {
  try {
  camera.setRotationAxis(new Point3D(1, 1, 0));
  camera.setRotate(50);
  i = 1;
  for (;;) {
  Thread.sleep(50);
  Platform.runLater(() -> {
  a += i;
  if (a >= 80 || a <= -80) {
  i = -i;
  camera.setRotate(a);
  } catch (final InterruptedException e) {
  }).start();
  public void start(final Stage stage) {
  go(stage, 512, 768);
  public static void main(final String... a) {
  launch(a);

The Scene constructor must activate the Z buffer via new Scene(pane,width,height,true); // last argument to true
Please close this issue

Similar Messages

  • Weird characters displaying in Workflow Builder screen

    When I go to workflow builder, there are weird characters displaying on the screen.
    Some look like this:  | ) ` 
    I'm not sure what is causing this to happen.
    The workflow works, but I'm not sure why this is happening.
    with best regards,
    Orlando

    Check your SAPGUI, try to get the latest patch. Better to go for 7.10
    Regards, IA

  • Weird event display problem in week view

    Hi. I'm getting a weird display problem in week view. First time this has ever happened.
    Some events appear to be missing, but when i double click on where I know the event is supposed to be, a new event is created (as excepted), and the missing events suddenly appear. When i move forward or back by a week, and then return to the week in question, the missing events are gone again. But, I can see the missing events in day view or month view.
    Any ideas?

    Dean,
    Next, try reinstalling the Mac OS X v10.6.2 Update (Combo).
    If that is unsuccessful:
    1. Use iCal>Export...>for each one of your individual calendars.
    2. Delete all but one of your calendars.
    3. Create a calendar and name it "Test."
    4. Delete the calendar which remained after step #2.
    5. Quit iCal.
    6. Remove the iCal plist, and drag the iCal plist file to your Desktop.
    7. Log out/in or restart.
    8. Restart iCal and use iCal>File>Import...for each one of the calendars that you exported in step #1.
    9. Delete the "Test" calendar, and any "Home/Work" calendar which was automatically created when you opened iCal in step #8.
    ;~)

  • Weird video display in FCP but normal in QT

    Okay, this is getting really tiresome now. Final Cut Studio has become weird on an Intel Core Duo iMac. When the symptoms first appeared FCP would not launch at all. It would quit on startup with a window to send a report to Apple. On that occasion I trashed and reinstalled the entire FC Studio.
    Following this the application opened so I assumed everything was OK. But then I went to import some AVCHD clips and FCP displayed the video with some weird looking semi-negative, metallic crappy special effects look. So ... I replaced the OS and reinstalled FCP Studio. Everything worked OK.
    Now, a day later, I go to import some more AVCHD clips and we are back to the weird video. Yet the same file opens normally in QuickTime. There are two screenshots of the same frame to illustrate this. One from FCP and one from QuickTime.
    http://grazer.free.fr/webstore/1_FCP.jpg
    http://grazer.free.fr/webstore/2_QT.jpg
    Has anyone seen this before or have any ideas because I am not going to devote another ten hours to reinstalling the poxy thing?

    Hello again Michael,
    Camera files are imported with Log & Transfer from SD cards with the AVCHD camera, P2 cards from the Panasonic HPX, from archived files of the complete card contents or imported from existing Capture Scratch files.
    The point is that the MacBook Pro behaves normally and the iMac used to. I have no idea why the same version of FCP on the iMac has suddenly become strange. Even stranger is that after reinstalling both system and FCP it all worked correctly and shortly afterwards the same weird stuff started again.
    Also, as mentioned, the Capture Scratch QT.mov file that FCP creates following a Log & Transfer reads normally with QuickTime - and iMovie - on the iMac.

  • Weird characters displayed on page instead of file download/preview

    Hi everyone,
    I have a download file procedure as per the instructions on the download.oracle.com page
    The download of the files worked just fine (or better say they were previewed in a new page) but recently a new schema has been added to the workspace so we can start the testings from the scratch.
    I modified the schema name where needed, but not the download page acts kinda weird, as instead of the file preview, I get a long page full of:
    �����JFIF�,,����&�Exif��MM�*������������������b�������j(�������1�������r2���������i�������������-����'�-����'Adobe Photoshop CS3 Windows�2008:07:28 16:41:20���������������������������]��������������������������&(�������������.������%��������H������H��������JFIF���H�H�����Adobe_CM�
    The issue is that if I switch back to the old schema, the result is the same. So, anyone has any idea of what can cause this?
    Thank you
    Regards
    Andrea

    Hi John,
    >
    <Location /pls/nxdev>
    Order deny,allow
    PlsqlDocumentPath docs
    AllowOverride None
    PlsqlDocumentProcedure wwv_flow_file_manager.process_download
    PlsqlDatabaseConnectString hostname:1521:... ServiceNameFormat
    PlsqlNLSLanguage NORWEGIAN_NORWAY.AL32UTF8
    PlsqlAuthenticationMode Basic
    SetHandler pls_handler
    PlsqlDocumentTablename wwv_flow_file_objects$
    PlsqlDatabaseUsername APEX_PUBLIC_USER
    PlsqlDefaultPage apex
    PlsqlDatabasePassword pass
    Allow from all
    </Location>>
    >
    CREATE OR REPLACE procedure schema.dl_file (p_fileid in number)
    as
    l_mime varchar2(255);
    l_length number;
    l_filename varchar2(2000);
    lob_loc BLOB;
    begin
    select col1,col2,col3,col4 into l_filename, l_length, l_mime, lob_loc from km_docs where kmd_id = p_fileid;
    -- Set up HTTP header
    -- Use an NVL around the mime type and if it is a null, set it to
    -- application/octect - which may launch a download window from windows
    owa_util.mime_header(nvl(l_mime,'application/octet'), FALSE );
    -- Set the size so the browser knows how much to download
    htp.p('Content-length: ' || l_length);
    -- The filename will be used by the browser if the users does a "Save as"
    htp.p('Content-Disposition: filename="' || l_filename || '"');
    -- Close the headers
    owa_util.http_header_close;
    -- Download the BLOB
    wpg_docload.download_file( Lob_loc );
    end;
    >
    Thanks!
    PS: Some updates...I tried it in IE as well (I use FF when working with applications) and funny enough the photos and documents get displayed/the download box shows up.
    But, all the files have the name f. f.pdf, f.jpeg etc
    I tried calling the dl_image procedure in the url (currently I call a new page where I pass the file id to an application id and then I call the above procedure in a pl/sql block):
    http://www.host/pls/dad/schema.dl_file?p_fileid=1
    And the name seems ok. I don't think it's a good idea to put the procedure name in the link, is it?
    Edited by: AndreaC on Nov 18, 2008 3:30 PM

  • Weird Finder display problem

    http://picasaweb.google.com/zhiyongsun3/200910WeirdMacProblem?feat=directlink
    http://picasaweb.google.com/lh/photo/Dgq3nB0np9peZn6p_lrcJw?feat=directlink
    Hi, sorry that I don't know how to post image directly, so you have to click the link to go to the picasa site to see the screen captures.
    Am having weird display problem with my Snow Leopard 10.6.1 on Macbook Pro 4,1. It's only in Finder item so far, things are randomly mis-displayed, or wiped out completely. If you see my screen shots you will have a clear idea.
    Is this a know problem? I don't even know how to search this problem on the web, or in this forum. I never seen such problem on my iMac with Leopard 10.5.7.
    Any solutions will be appreciated. Of course, right now restart seems to be the only solution I have.

    he general approach at this time is to ask if you've checked for any problematic fonts (all languages) with Apple's Font Book (look in the Applications folder). Find and remove all duplicates also.
    Start there to be sure all fonts that are in play come out with a clean bill of health.
    Also, don't hesisate to perform wholesale deletion of old and/or little used fonts - be skeptical of anything that has come from Office 2008, including those related to an Equation Editor installation.

  • Weird note display in piano roll

    All they notes in the piano roll display have suddenly acquired blocks of colour and a keyboard has appeared on the right hand side with enormous keys. The blocks of colour seem far apart, not at all like the notes that were there before this weird thing happened. I've undone a dozen times but it seems this isn't something I can undo. I can find nowhere to change this and I can find no mention of it in Logic HELP. Can somebody set me straight please?

    Yes, sereen, you're right on the money. I was zoomed in until I could see the atoms that made up the notes. The display was so bizarre - each note was contained in a green box with a yellowish edge. Having never seen anything like it I panicked. Thanks for your help.

  • Weird OSX display issues after going to webpage, only thing that fixes is  Perm repair

    I have a bizarre issue that i'd love some input on. Late 2009 iMac, Mountain Lion (then Mavericks).
    I use Firefox to utilize a real estate website (Fusion MLS) for several months now. A couple of days ago, after i would log into the website and use it for a little bit, the rest of my tabs, apps, windows, would all start appearing as black boxes, or have glitched out (generally black) screen display issues. To be clear, other tabs inside the browser would be black, or partially black, and also the right half of my taskbar icons would be black silhouettes of the icon. BUT, the Fusion MLS website would still work fine. Closing the page, etc, would not fix the problem, it would be stuck like that no matter what i closed or opened, computer would function fine except for the display, but i couldnt see hardly any of the apps so I'd have to shutdown, but a simple reboot didnt fix it. After an hour of troubleshooting, I started off in Mountain Lion when the problem appeared, and in the process of troubleshooting I decided to upgrade to Mavericks to see if that would fix the problem, it didnt. Ultimately I discovered the only thing that fixes the problem is to boot into Safe Mode and Repair Permissions, then i can come back in as normal and everything is normal again (a standard reboot doesnt fix it, when logging back into OSX it would still have black silhouettes and all the app windows would be black).
    So after the above I decided to just start using a different browser to go to this Fusion MLS website (Safari). Which worked fine for a day, but now when i go to the website, i have no problems, but when i put the computer to sleep, and bring it back, the windows are blacked out and icons silhouetted. So back to safe mode, repair perms, and then it works again. When i do the repair perms, there are usually no verbose things that it says it repairs, sometimes it says something about the PrinterList being 0 instead of 80, but thats it.
    Any help or insight would be greatly appreciated, I'm completely dumbfounded....

    Now regular Repair Perms doesnt fix it, it has to be Diskwarriors Repair Perms. Also it happens anytime the computer is put to sleep for a length of time and brought back, regardless of whether the Fusion MLS website was gone to.

  • Weird 23" display pattern (picture)

    Hi there,
    A few months ago, my 23" cinema display has developed some kind of "marble" pattern , which appears to be underneath the screen surface.
    I have followed numerous discussions on color consistency woes with this particular monitor, but I have never come across an issue like that one.
    Unfortunately, I'm a few months out of warranty, and while the technical issue is annoying, (German) Apple customer service will not even discuss a possible rebate on repair costs for even a piece of their most expensive 'pro' equipment, let alone a replacement, as it seems.
    That said, has anyone here seen anything like that before, and can possibly offer some advice on how to take care of it ?
    Thank you in advance,
    Thomas
    Image link --->
    http://img116.imageshack.us/img116/2600/display4lf.jpg
    ACD 23" aluminum   Mac OS X (10.3.9)   G5 DP 2.0 gHz / Radeon 9600

    The display backlight consists of multiple, often two or three, CCFL (cold cathode fluorescent tube) lamps. Behind the backlight is a reflective foil designed to spread the light evenly across the whole panel. To me, it looks like this foil has become crumpled in your display.
    Unfortunately, since the foil is enclosed within the LCD panel assembly, there isn't an easy fix.

  • Help viewer is weird to display topics

    Hi,
    When I try to get help with the help viewer, I enter a word in the little window for a keyword search and Help always display that He can't find anything (Aucune rubrique d'aide correspondante n'a pu être trouvée in french) Per exemple : if I enter the word Safari... it's simple!! but after this message I go back with the little arrow and it display finally the information that he was supposed to display !!! Do I need the trash the library folder com.apple.helpui ??? What append after that?

    Help Viewer crashes or shows blank....
    http://discussions.info.apple.com/webx?[email protected]@.6897a2ae http://www.thexlab.com/faqs/helpviewer.html
    This is a common bug in Panther. The solution to this problem is simple though:
    • (~ means your home directory)
    Go to ~/Library/Preferences and delete the following files......
    com.apple.help.plist
    com.apple.helpui.plist (you may or may not have this one).
    com.apple.helpviewer.plist
    Next go to ~/Library/Caches and delete the folder......
    com.apple.helpui
    Log out and log in. If the problem is gone, empty the trash. If not, put everything back.
    or you can open MacHelp directly from .....
    /Library/Documentation/Help and it works fine.
    george

  • Weird icon display problem (9iAS Forms 9.0.4)

    Let me start out with the fact that I have setup 6 or 7 systems displaying GIF's as icons in web forms (both Forms 6i and Forms 10g/9.0.4). So I know all about setting the registry.dat, virtual directory for the icons etc. I have setup the environment correctly (unless some fat finger typing has gotten in the way).
    When I load a form in a web browser and I watch the status bar on the bottom of the broweser ( IE6 or IE7) I can see that it loads the GIF's (fortunately my server is just slow enought that I see the "loading .....xyz.gif" statements for my GIF icons.
    What happens is that none of the icons display on the buttons. Of course when I run the form in the IDE the icons display as expected.
    Has anyone run into this problem before and if what was the solution?
    TIA,

    1. The image files cannot be found or are not accessible. Just because you see something on the client that says "Loading..." does not necessarily mean it was found. Check the HTTP Server error_log. If you see HTTP 404 errors you have an access or virtual path problem.
    Answer: No HTTP 404 Errors (no errors at all). FYI, Files are located in D:\icons (W2K server) and the Security is set to "Everyone" with Full Access/Control. The AS has "D:\icons" mapped to /icons and Registry.dat has the path set to /icons.
    2. You are using an image format that isn't supported. For example, Forms supports GIF files, but not GIF files with transparent backgrounds. Also, Forms does not support most of the compression formats associated with GIF and JPG. Test with an image that you know will work. For example the OTN Logo on this page. Right click on the image and choose Save Picture As.... or:
    http://www.oracle.com/admin/images/otn/otn_logo_small.gif
    Actually, you should be able to simply put the entire URL above into the image filename field on the Property Palette for any Iconic button large enough to hold it.
    I pretty sure this works in 10.1.2, not so sure about 904
    Answer: You'll probably say this is not good enough, but the images work in the IDE, therefore I conclude that they should work on the AS (i.e. size and display type are correct/supported). I did not have a button that was big enough for the Oracle logo, hence I did not try it.
    3. The image size is too large for the button.
    Answer: see answer above.
    4. References to images are case sensitive. It is recommended that your image files (in the file system) use all lower case letters, including the extension. The reference in the form should also be lower case.
    Answer: all image names in the property pallet are lower case and the actual file names are lower case (as shown in Windows Explorer).
    With regard to the other post about icon names ending a list of specific characters, some do and some don't, but ALL my icons are NOT displaying.
    Lastly, these exact same icons have worked in the past (who does not reuse icons?).

  • Weird time display thing going on...

    This just began today, but the time display on my Finder bar keeps freaking out. Click the image link below to see what I mean.
    http://i9.tinypic.com/6gun8ko.jpg
    You notice how it's trying to spell Tuesday, but you see the T, u and e stack atop one another. The problem happened with the time earlier this evening, and I restarted my computer. It fixed it, but now it's doing it again. Anyone else been having this problem? Any way to fix it? Thanks.

    Actually, I have no idea why it might be doing this, but there are a couple of things to try.
    Since the time and date depend on your battery, you might check on the health of your battery (About this Mac>More Info>Power.)
    You could also try resetting the PMU.
    On general principles, you could go to Disk Utility and verify and repair permissions.
    If nothing helps, please post back.
    Good luck!

  • Weird Text display in Mail & Safari

    Whenever I use Safari or My OS X Mail, I get certain text that will show up in weird characters. This does not happen when I use Explorer as my internet browser or my email from any other application. Does anyone know why this is or how to change it? Would it help if I upgraded to Tiger? I am currently using Panther 10.3.9. I also am working on a imac G4. Any advice would be great. Thanks.

    melissa,
    Just guessing, but according to Kurt Lang...Helvetica Fractions is a known source of many font issues. Kurt Lang also has an excellent treatise called Font Management in Mac OS X Tiger and Panther, which may help answer your question.
    ;~)

  • Weird messages displayed on booting up

    Hi All!
    Since a lot of time ago,  I am receiving below messages when booting:
    1) got a wrong device descriptor, warm reset device
    2) cannot enumerate usb device on port 2
    these errors are regarding to my external hdd connected through usb 3.0 to my laptop. I have installed linux and boot it from there.
    My laptop is new, and the external usb 3.0 cable as well. My external hdd is working ok, without problems but those messages comes every time I boot linux.
    I highly appreciate if someone could explain me why those messages are displayed when booting and how to solve it?
    arch linux kernel: 3.14.5-1-ARCH
    Last edited by toni (2014-06-08 08:42:12)

    Thanks xephinx,
    When I tried downgrading udev to 164, I got this message:
    error: failed to prepare transaction (could not satisfy dependencies)
    :: upower: requires udev>=165
    When I tried downgrading upower, it turned out there was only one version being 0.9.8-2. This package is required by gdm and gnome-session.
    Is there any way I can solve this?

  • Weird characters displayed after Windows update

    A user encountered this issue after a Windows update.
    https://twitter.com/summerscope/status/414887724131168256/photo/1
    Did anyone encounter this too, and what did you do?
    Thanks in advance.
    serene
    Community Advocate Program Manager
    English Community   Deutsche Community   Comunidad en Español   Русскоязычное Сообщество

    Hi John,
    >
    <Location /pls/nxdev>
    Order deny,allow
    PlsqlDocumentPath docs
    AllowOverride None
    PlsqlDocumentProcedure wwv_flow_file_manager.process_download
    PlsqlDatabaseConnectString hostname:1521:... ServiceNameFormat
    PlsqlNLSLanguage NORWEGIAN_NORWAY.AL32UTF8
    PlsqlAuthenticationMode Basic
    SetHandler pls_handler
    PlsqlDocumentTablename wwv_flow_file_objects$
    PlsqlDatabaseUsername APEX_PUBLIC_USER
    PlsqlDefaultPage apex
    PlsqlDatabasePassword pass
    Allow from all
    </Location>>
    >
    CREATE OR REPLACE procedure schema.dl_file (p_fileid in number)
    as
    l_mime varchar2(255);
    l_length number;
    l_filename varchar2(2000);
    lob_loc BLOB;
    begin
    select col1,col2,col3,col4 into l_filename, l_length, l_mime, lob_loc from km_docs where kmd_id = p_fileid;
    -- Set up HTTP header
    -- Use an NVL around the mime type and if it is a null, set it to
    -- application/octect - which may launch a download window from windows
    owa_util.mime_header(nvl(l_mime,'application/octet'), FALSE );
    -- Set the size so the browser knows how much to download
    htp.p('Content-length: ' || l_length);
    -- The filename will be used by the browser if the users does a "Save as"
    htp.p('Content-Disposition: filename="' || l_filename || '"');
    -- Close the headers
    owa_util.http_header_close;
    -- Download the BLOB
    wpg_docload.download_file( Lob_loc );
    end;
    >
    Thanks!
    PS: Some updates...I tried it in IE as well (I use FF when working with applications) and funny enough the photos and documents get displayed/the download box shows up.
    But, all the files have the name f. f.pdf, f.jpeg etc
    I tried calling the dl_image procedure in the url (currently I call a new page where I pass the file id to an application id and then I call the above procedure in a pl/sql block):
    http://www.host/pls/dad/schema.dl_file?p_fileid=1
    And the name seems ok. I don't think it's a good idea to put the procedure name in the link, is it?
    Edited by: AndreaC on Nov 18, 2008 3:30 PM

Maybe you are looking for