Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - pitt

Pages: [1]
1
Support / need triangle strip data
« on: May 30, 2006, 05:40:24 pm »
I want to manually draw an object using triangle strips.
I think Object3D.createTriangleStrips() might prepare some data for rendering with triangle strips,isn't it?

Well.  Let's see the code for rendering with triangle strips.

GL11.glBegin(GL11.GL_TRIANGLE_STRIP);
GL11.void glVertex3f(x[0],y[0],z[0]);
GL11.void glVertex3f(x[1],y[1],z[1]);
 for (int i=2;i<x.length;i++)
   GL11.void glVertex3f(x,y,z);
GL11.glEnd();

How can I get array x,y and z for rendering?

2
Support / need triangle strip data
« on: May 30, 2006, 12:22:02 pm »
I would like the triangle strip data.
Enable it for me please... Thank you. :D

3
Support / manually draw a face
« on: May 25, 2006, 05:12:15 pm »
Hi egon,

    Correct this code for me please.
    manually draw the face by a given Object3D and the polyid.
   
    PolygonManager poly=obj.getPolygonManager();
    GL11.glBegin(GL11.GL_TRIANGLES);
    SimpleVector p=poly.getTransformedVertex(polyid,2);
    GL11.glVertex3f(p.x,p.y,p.z);
    p=poly.getTransformedVertex(polyid,1);
    GL11.glVertex3f(p.x,p.y,p.z);
    p=poly.getTransformedVertex(polyid,0);
    GL11.glVertex3f(p.x,p.y,p.z);
    GL11.glEnd();

    This code goes wrong when I rotate the Y axis of the Camera.
Other axes work properly, I guess.  I need to manually draw some faces cause they are not listed in VisList. But, they can be seen.

Thank you.

4
News / Driving a tank *offtopic*
« on: May 11, 2006, 06:48:01 am »
So cool!

5
Support / request some new functions
« on: May 09, 2006, 07:07:34 am »
That's great! ok.  :D

6
Support / request some new functions
« on: May 05, 2006, 10:16:13 am »
Thanks a lot!  :D

7
Support / request some new functions
« on: May 04, 2006, 04:29:25 am »
I don't get it. :?  

Here is my brief code for realtime shadow.



while (true)
{

  GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT | GL11.GL_COLOR_BUFFER_BIT | GL11.GL_STENCIL_BUFFER_BIT);

   World.renderScene(FrameBuffer);

    for (int i=0;i<VisList.getMaxSize();i++)
    {
      VisList.getData(i,data);
      if (IsShadowReceiver(data))
     {
          //render the face and the shadow
          glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
          glStencilFunc(GL_ALWAYS, 0x1, 0);
          glEnable(GL_DEPTH_TEST);
     
          //draw the face with stencil mask
             World.draw(FrameBuffer,Interact2D.getObjectID(data),Interact2D.getPolygonID(data));
            glDisable(GL_DEPTH_TEST);
   
          //projective shadow          
          glStencilFunc(GL_EQUAL, 1, 1);
          glEnable(GL_BLEND);
          list=shadowpolygon(data,lightpos);     //find the object that cast a shadow on this face
          for (int j=0;j<list.length;j++)
          {
           shadowmatrix(matrix,data,lightpos);  //create the matrix to project a shadow polygon on the face
           GL11.glPushMatrix();
           GL11.glMultMatrix(matrix);
           mydraw(list[j]);              //draw the projective shadow
           GL11.glPopMatrix();   
          }
          glDisable(GL_BLEND);

         //remove the stencil mask
         glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
         World.draw(FrameBuffer,Interact2D.getObjectID(data),Interact2D.getPolygonID(data));
         glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
      } else  
     {
       //no shadow just render the face
       World.draw(FrameBuffer,Interact2D.getObjectID(data),Interact2D.getPolygonID(data));
      }
    }

    FrameBuffer.update();
    FrameBuffer.updateGLOnly();
    Thread.yield();
}

Any suggestion?

8
Support / request some new functions
« on: May 03, 2006, 10:57:38 am »
Hi, Egon. I need your help to continue my project.

- Could you enable the rest of PixelFormat args please.

PixelFormat(int bpp, int alpha, int depth, int stencil, int samples, int num_aux_buffers, int accum_bpp, int accum_alpha, boolean stereo)
 
You might add more variables in Config Ex. Config.glStencilBpp


- just draw a specific face by objid,polyid retrieved from VisList

World.draw(FrameBuffer buffer,int objid,int polyid)


These should be enough to make real time shadow in my project.

Thank you very much.

9
Bugs / checkCollision
« on: April 19, 2006, 05:35:18 pm »
Object3D obj=Primitives.getPlane(1,500);
obj.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);
world.addObject(obj);
int p1=world.checkCollision(new SimpleVector(0,0,-100),new SimpleVector(0,0,1),200f);
SimpleVector p2=world.checkCollisionSpherical(new SimpleVector(0,0,-100),new SimpleVector(0,0,200),10f);
SimpleVector p3=world.checkCollisionEllipsoid(new SimpleVector(0,0,-100),new SimpleVector(1f,1f,1f),1);



p1=Object3D.NO_OBJECT
p2=(0,0,200)
p3=(0,0,89)                        
 

?? Something wrong

10
Support / stencil & accumulation buffer
« on: April 17, 2006, 02:43:38 pm »
To create real time shadow, depth of field, motion-blur and other effects, those buffers need to be enabled.

I would like to access to some internal variables in your engine to create those effects. Or any other ideas?

11
Support / Sky
« on: April 17, 2006, 02:00:42 pm »
use the technic called 'skybox'.

Some free sky textures.
http://www.octanedigitalstudios.com/page4.html
http://www.scentednectar.com/skyboxes/

Source code

     float size=4000;
     String[] name={"top","front","left","right","back"};
     for (int i=0;i<name.length;i++)
     {
     InputStream in=new FileInputStream(name+".jpg");
     BufferedImage b=null;
     try
     {
      b=ImageIO.read(in);     
     } catch (Exception e) {}
     Texture pic=new Texture(b,false);
     pic.enableGLClamping();
     TextureManager.getInstance().addTexture(name,pic);
     }
     Object3D[] o=new Object3D[name.length];
     //top
     Object3D obj=Primitives.getPlane(1,size*2);
     obj.rotateZ((float)Math.PI/2);
     obj.rotateX((float)Math.PI/2);
     obj.translate(0,size,0);
     o[0]=obj;
      //front
     obj=Primitives.getPlane(1,size*2);
     obj.translate(0,0,size);
     obj.rotateZ((float)Math.PI);
     o[1]=obj;
     //left
     obj=Primitives.getPlane(1,size*2);
     obj.translate(size,0,0);
     obj.rotateZ((float)Math.PI);
     obj.rotateY((float)Math.PI/2);
     o[2]=obj;
     //right
     obj=Primitives.getPlane(1,size*2);
     obj.translate(-size,0,0);
     obj.rotateZ((float)Math.PI);
     obj.rotateY((float)-Math.PI/2);
     o[3]=obj;    
     //back
     obj=Primitives.getPlane(1,size*2);
     obj.translate(0,0,-size);
     obj.rotateZ((float)Math.PI);
     obj.rotateY((float)Math.PI);
     o[4]=obj;    
     
     for (int i=0;i<name.length;i++)
     {
       o.setTexture(name);
       o.setLighting(Object3D.LIGHTING_NO_LIGHTS);
       o.build();
       world.addObject(o);
     }

12
Support / How could I pickPolygon behind some transparent faces?
« on: March 24, 2006, 02:26:57 am »
Thank you very much!!  :D
It works.

I suggest that not just transparent objects to be extruded.
To generalize the pickPolygon, those mouse unselectable objects should be extruded too.
Some cases like unuseable weapon or corpse drop on the ground need it.

I might need it in the future.  :wink:

13
Support / How could I pickPolygon behind some transparent faces?
« on: March 23, 2006, 04:27:32 am »
Hi,

     I want to pick the terrain face. But, what if there are some transparent faces like smoke over that terrain face. How could I pickPolygon behind that transparent faces? If i disable the mouse selectable of those transparent faces, pickPolygon'll return null not the terrain face behind them. I try to use reproject2D3D with z by adding more z to avoid that transparent faces. But, I don't know how much z to set to avoid them cause my terrain is not flat. For example, i give z=0 then call pickPolygon and check that the returned face is the terrain face. If not, I add more z for reproject2D3D then call pickPolygon again until I get null or the terrain face. Sometimes, it miss the terrain face! I think it's not good that pickPolygon has to be called again and again as well. Any other way?
         
Thank you.

Pages: [1]