Author Topic: why render invisible object3d??  (Read 3436 times)

Offline roninjnj

  • byte
  • *
  • Posts: 20
    • View Profile
why render invisible object3d??
« on: August 27, 2008, 10:15:20 pm »
Hi!! a new question!!

I have next code:

Code: [Select]
              if (!wireframe)
             {                
        cursorMouse.setVisibility(false);
       
        shadowHelper.updateShadowMap();       
        buffer.clear(java.awt.Color.GRAY);       
                         shadowHelper.drawScene();                                 
             }
             else
             {
        buffer.clear(java.awt.Color.BLACK);
                     world.drawWireframe(buffer, colorWireFrame);
             }       

             buffer.update();
             buffer.displayGLOnly();
             canvas.repaint(); 
            
             cursorMouse.setVisibility(true);
        }

NOTE: CursorMouse is a Object3D instance.

Ok, the problems...

1)  I can´t switch to wireframe mode, it only draw a black screen.

2)  cursorMouse is displayed in any frames, in another frames is displayed his shadow only (but cursorMouse is not added to shadowHelper (not set to addcaster or addreciver), and in another cases, both are displayer, geometry with texture and shadow. Why? Its is set not visible before render and set visible after render. (it is always in mode non-selectable).

Thanks!!!
« Last Edit: August 27, 2008, 10:19:43 pm by roninjnj »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: why render invisible object3d??
« Reply #1 on: August 27, 2008, 10:22:59 pm »
I'm not sure what exactly you are talking about. Do you have a screen shot?

Offline roninjnj

  • byte
  • *
  • Posts: 20
    • View Profile
Re: why render invisible object3d??
« Reply #2 on: August 27, 2008, 10:33:32 pm »
Its a sample of my problem.

I have a map dividided in squares to a turn based strategy game.

I use a gemometry with texture (with blending actived) to know in what square in 3d world is aiming mouse (using 2DInteract).

I had this error, and i didnīt know what code is doing some bad. Then I decided go directly to render bucle and do that test:   

                                             1) hide object3D mouseCursor.
                                             2) render shadows and scene.
                                             3) and finally, set object3D mouseCursor setVisible(true).

In theory, object3D mouseCursor should be not visible in window. BUT in some frames, it appears!

I donīt know why... ŋ?



 I have assigned a geometry with texture to aim positions with mouse. , but a got this problem.


Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: why render invisible object3d??
« Reply #3 on: August 27, 2008, 10:56:53 pm »
Again, which version of jPCT? 1.16 has a major problem with enabling/disabling object via the ShadowHelper. Please let me know what Config.getVersion() returns.

Offline roninjnj

  • byte
  • *
  • Posts: 20
    • View Profile
Re: why render invisible object3d??
« Reply #4 on: August 27, 2008, 11:06:46 pm »
Version returned is  1.17.

I solve the problem removing this object3D from world, updating shadowmap, inserting again this object into the world, and rendering scene with shadowHelper.

If the object3D is not in world, it can be appear in shadow map rendering.

If a new version of JPCT is relase in future, I will modify the code. Now, it is runing rigth with that method.

Thanks for all!!

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: why render invisible object3d??
« Reply #5 on: August 28, 2008, 12:23:45 am »
Can you create a simple test case that shows the problem, so that i can find and fix it in a later version? Right now, i can't reproduce it. Obviously, i'm doing something different... ???

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: why render invisible object3d??
« Reply #6 on: August 28, 2008, 02:43:48 pm »
I've checked the visibility-handling in the ShadowHelper of 1.17 again...it seems correct to me. Are you by any chance adding or removing objects to/from the world from another thread?

Offline roninjnj

  • byte
  • *
  • Posts: 20
    • View Profile
Re: why render invisible object3d??
« Reply #7 on: August 28, 2008, 04:43:18 pm »
I was looking the problem.

Code is larger, need more time. I have another thread to put-remove object3Ds in the world variable.

Problem only appear with a polygon attached to mouse movements ,mouse.getX() and mouse.getY() is checked in main thread.

But nerver NEVER is add this poligon to a shadowCaster with addCaster o reciveCaster, and sometimes a shadow of this poligon appear .

Iīm going more test to find problem and send you results.

Is version 1.17 lastest version of JPCT??

Thanks!  (Sorry my english)



Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: why render invisible object3d??
« Reply #8 on: August 28, 2008, 07:28:21 pm »
1.16 is the latest official release. What is in the download/beta-directory is a pre-release version of 1.17, which is the latest available version. The ShadowHelper affects object visibility even when an object is no caster and/or receiver, because it has to exclude all other objects from the process. If another thread adds/removes objects to the world while the helper is running, everything may happen. Never ever add/remove objects from outside the rendering thread without synchronizing things. jPCT isn't thread safe...please keep that in mind.

Offline roninjnj

  • byte
  • *
  • Posts: 20
    • View Profile
Re: why render invisible object3d??
« Reply #9 on: August 28, 2008, 07:30:48 pm »
Okis!!! thanks very much again!! ;)