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 - mxar

Pages: 1 ... 3 4 [5] 6
61
Support / Re: Vertex colouring from last jPCT-AE version
« on: October 13, 2014, 12:40:04 pm »

Thanks for your answer.

I wrote the following code:

       int vertices = object3D.getMesh().getUniqueVertexCount();
        Log.d(TAG," vertices = " + vertices);

        float[] data = new float[4*vertices];

        for(int i = 0; i < data.length; i++){
           
            data = 0.0f;
           
            if(i%3 == 1)
                data = 1f;
           
           
        }
         
        VertexAttributes  vattrs = new VertexAttributes("colorinfo",data,VertexAttributes.TYPE_FOUR_FLOATS);

        object3D.getMesh().addVertexAttributes(vattrs);
       
        GLSLShader  shader = new  GLSLShader( Loader.loadTextFile(mActivity.getResources().openRawResource(R.raw.vertexshader)),Loader.loadTextFile(mActivity.getResources().openRawResource(R.raw.fragmentshader)));

        object3D.setShader(shader);
       
       object3D.strip();
       object3D.build();
       world.addObject(object3D);

 The vertex shader is:

attribute vec4 colorinfo;
uniform mat4 modelViewProjectionMatrix;
attribute vec4 position;
varying vec4 vertexColor;


void main(void)
{
     vertexColor = colorinfo;
     gl_Position = modelViewProjectionMatrix * position;

}
 
And the fragment shader is:

varying vec4 theColor;
varying vec4 vertexColor;


void main(void)
{
 gl_FragColor = vertexColor;
}

I think that works . Am i correct? 

Also I have a question about the  method:


Object3D obj = Object3D(float[] coordinates, float[] uvs, int[] indices, int textureId) 

How can I apply material info in this case to Object3D obj?

Thanks in advance.

62
Support / Re: Vertex colouring from last jPCT-AE version
« on: October 10, 2014, 03:43:41 pm »
Hi again,

How  can i assign the vertex color colorinfo in the vertex shader?

I need to use the position of vertex inside the vertex shader program?

I wrote a program based on previews reply but compiler shows the following error message:

"Error missing attribute position in vertex shader"

Also, should I write and a fragment shader?

Can you give me an idea of how the vertex and (if needed) fragment shader must be?


Thanks in advance

63
Support / Re: Vertex colouring from last jPCT-AE version
« on: September 29, 2014, 09:35:51 pm »

Many thanks.
 

64
Support / Re: A Racing game
« on: September 29, 2014, 09:30:48 pm »
Thanks for your answer.

I agree that is better to load all the 3D Objects at the beginning of the game.

65
Support / A Racing game
« on: September 29, 2014, 12:02:23 pm »
Hi,

Im thinking to start a racing game.

But i dont know the best way to build the road.

Should I use plane 3D objects ?
Should I load the parts of the road once at the begining of the game or dynamically?


Thanks in advance



66
Support / Vertex colouring from last jPCT-AE version
« on: September 29, 2014, 11:57:20 am »
Hi,

vertex colouring is supported by the latest jPCT-AE version?

Thanks in advance.

67
Support / Re: framebuffer getPixels()
« on: September 25, 2014, 11:22:37 am »

it works.

thanks

68
Support / Re: framebuffer getPixels()
« on: September 25, 2014, 09:05:30 am »

Sorry,

I forgot to say that i use NEXUS 5.

69
Support / Re: framebuffer getPixels()
« on: September 25, 2014, 09:03:13 am »

Hi,

I use opengle 1.x

I use the following code to build a bitmap from FrameBuffer:

The FrameBuffer is resized to  128x128.

The Bitmap renderImage  is used as a bitmap for an ImageView view.


   public void onDrawFrame(GL10 gl) {
      
      coinObject3D.rotateY((float) (Math.PI/180.0f));
      cube.rotateY((float) (Math.PI/180.0f) * -1);
      
      //cube.translate(x, y, z)
      prevXRot  = xrot;
      prevYRot  = yrot;
      prevZRot  = zrot;
      
            
      fb.clear(back);
      int w = fb.getWidth();
          int h = fb.getHeight();
      
    
       world.renderScene(fb);
      
       int[] tmpPixels = fb.getPixels();
      
       
        renderImage = Bitmap.createBitmap(tmpPixels, fb.getWidth(), fb.getHeight(), Config.RGB_565);

       Log.d("TAG", "width = "  + fb.getWidth());
      Log.d("TAG", "height = " + fb.getHeight());
      
      world.draw(fb);
      
      //fb.runPostProcessors();
      fb.display();
      
      

      if (System.currentTimeMillis() - time >= 1000) {
         Logger.log(fps + "fps");
         fps = 0;
         time = System.currentTimeMillis();
      }
      
      fps++;
   }


Thanks in advance


70
Support / Re: framebuffer getPixels()
« on: September 24, 2014, 10:59:49 pm »
Hi,

can anybody help me?

I call the following code :

int[] tmpPixels = frameBuffer.getPixels();

renderImage = Bitmap.createBitmap(tmpPixels, frameBuffer.getWidth(), frameBuffer.getHeight(), Config.ARGB_8888);

When i try to load the renderImage Bitmap in ImageView ( calling imageView.setImageBitmap(renderImage))

i see only a black rectangular.


Thanks in advance




71
Support / Re: [Tips] Android, augmented reality 3D with JPCT + Camera.
« on: September 20, 2014, 04:43:10 pm »
 Thanks for the help.
 I'm sure your answer will be usefull to complete the project.


72
Support / Re: [Tips] Android, augmented reality 3D with JPCT + Camera.
« on: September 19, 2014, 10:23:50 pm »

Actually the 3D Objects are rendered on GLSurfaceView surface.

I use two surfaces: the camera and the GLSurfaceView surface one on top of other.

So what do you think , is it possible to load dynamically 3D objects on  GLSurfaceView ?.

These 3d Objects are stored in a remote server and under some conditions the AR engine downloads them.

As i described before, the AR then fills a data buffer with the content of the downloaded 3D object and notifies the renderer engine.

The renderer engine then reads the contents of the data buffer and draws the 3D Object on GLSurfaceView.

I must know the specific type of 3D object (.3ds, .obj .. ) before reading and parsing the contents of data buffer?

What about the texture images? are not stored now in assets or raw folder.

Thanks in advance.





73
Support / Re: [Tips] Android, augmented reality 3D with JPCT + Camera.
« on: September 19, 2014, 02:45:00 pm »


In the project  i have  to show dynamically 3d objects on the surface of the camera.

The renderer engine is notified by AR engine that a new 3d Object is ready to be displayed on camera's surface.
The 3d object is stored by AR engine dynamically in a data buffer.

So the renderer engine reads from the data buffer the content, parses the content, and then must show the 3d object on camera's surface.

Do you think that this will work with jPCT-AE?

Before parsing the contents of the data buffer I must know the type of 3d Object (.3ds,.obj ...)?

I need to specify the location of texture images?


Thanks in Advance





74
Support / Re: [Tips] Android, augmented reality 3D with JPCT + Camera.
« on: September 18, 2014, 10:03:39 pm »

Thanks for your answer but

what about the texture images?

I dont want to load them from raw or assets folder.

I want to load them from the memory (data bufffer).


Thanks in advance.


75
Support / Re: [Tips] Android, augmented reality 3D with JPCT + Camera.
« on: September 18, 2014, 04:07:17 pm »
Hi,

I'm working in a Augmented Reality project using jPCT-AE as the rendering engine.


I need to load dynamically on the camera surface a 3D Object from a data buffer (memory) not from  the raw or assets directory.

Is it possible?

Thanks in advance

Pages: 1 ... 3 4 [5] 6