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.


Topics - nathan

Pages: [1]
1
Support / Loader doesn't load 3DS normal vectors?
« on: May 02, 2013, 06:34:50 am »
When I load a 3DS model, it seems that you re-calculate normal vectors:

Quote
I/jPCT-AE ( 8492): Object Cube_jPCT6 hasn't been build yet. Forcing build()!
I/jPCT-AE ( 8492): Normal vectors calculated in 5ms!

Why?  Is there a way I can prevent the normals from being rebuilt? Or are the normals not exporting properly? (Blender 2.6 doesn't have an option to tick for normals)

Actually, I just tried the same with OBJ, with "export normals" ticked.  And checking the OBJ file, the normals are written there.  So, what is going on?  Why won't it keep the normals from the object?

2
Support / Caching Vertex/UV/Normal data
« on: May 01, 2013, 10:41:20 pm »
I don't want to open an InputStream to my 3DS model every time I want to instantiate a new one.  I would like to load that data somehow. From what I have read, there is no simple way of doing this.  Why?

I can get the UV coordinates from the Object3D.getPolygonManager().getTextureUV()
I can get the Vertex coordinates from the GenericVertexController.getSourceMesh()
I can get the Normal coordinates from the GenericVertexController.getSourceNormals()

Then I can flatten all the information into a bunch of float arrays. 

Then, I can instantiate new Object3D with the UV and Vertex information
But to get the normal data back in, I have to then make another GenericVertexController to modify the DestinationNormals.

Why is this so complicated? There should be a simple method to cache this information.
When I instantiate the new object, what should I put into the int[] index field?

3
Support / Rendering a Android View onto a texture
« on: April 29, 2013, 03:27:00 am »
I would like to have a standard android View (such as Button), and render its graphics onto a texture.  I can create a bitmap, create a canvas for the bitmap, and have the view draw onto the bitmap through the canvas.  Then, I can take the bitmap and turn it into a texture.  This works fine. However I am having difficulties with updating that texture later (button was pressed, text changed, etc).  Of course I cannot create a new texture each time it changes.

I thought the solution was to change the render target of the framebuffer to the texture, and then blit the bitmap onto it.  However, this doesn't seem to work.

I think the problem is that I am using OpenGL ES 1.0.  What is the minimum version of OpenGL ES I need to do this?  What is the optimum way of doing this?  One framebuffer per texture? Or one framebuffer that gets passed around?  The javadoc says that blit(int[]) is slow, is there an alternative without having to create a new texture every time the android view changes?

4
Support / Child/Parent relationship
« on: April 11, 2013, 12:40:47 am »
Why is there no method like
Code: [Select]
Object3D[] getChildren()but there is
Code: [Select]
Object3D[] getParents()
I have a group of objects (From another example, it is a car and its 4 wheels).  I want them all to move together, so I add them as children to another object, which is a collision mesh.  And, now I would like to pass the reference to the outer object around, and change all the children simultaneously.  For instance, I want to change visibility, or remove them from the world.

All I can think of doing is extend the Object3D class, override the addChild() function to also add the child to a list.  Then add a getChildren() function that just returns that list as an array and use this in my own functions. 

I just don't understand why there is no getChildren() function?

5
Support / One World, Two OpenGL Contexts
« on: April 10, 2013, 11:23:28 pm »
I am trying to render the same scene onto two displays, using Android's Presentation mode.  Because of Presentation mode, I am required to have two OpenGL threads and contexts.

I, of course, do not want to have two Worlds and two of every object.  So I created one world, and had both scenes render it.  Of course this would cause threading issues, so I synchronized the calls in a method called doRender()  Only one thread is ever reading the World data, and I have confirmed this with logs.

This seems to run just fine.  And, every time my doRender() function is called, I get this at the begining:
Code: [Select]
I/jPCT-AE ( 1784): OpenGL context has changed(2)...recovering for renderer 1/0!
I/jPCT-AE ( 1784): Creating buffers...
I believe this is because the World knows that it is being asked to render to a different context, and so it loads different texture buffers, etc.  Is that right?  I know this is not ideal, but it may be necessary.

And, this runs for a few minutes, but then will crash. And I get this:
Code: [Select]
I/jPCT-AE ( 1976): OpenGL context has changed(2)...recovering for renderer 0/1!
E/SurfaceTextureClient( 1976): queueBuffer: error queuing buffer to SurfaceTexture, -12
I/jPCT-AE ( 1976): Creating buffers...
W/GLThread( 1976): eglSwapBuffers failed: EGL_BAD_NATIVE_WINDOW
F/libc    ( 1976): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 1990 (Thread-145)
And it prints a bunch of debug information
This seems to happen near the 12750th call to doRender

Why is this crashing?  Is it allocating too much memory every time the buffers are created?

Is there a way to tell JPCT that it will constantly be switching between two GL contexts?

6
The function
Code: [Select]
public int checkCollision(SimpleVector org, SimpleVector dr, float step)returns the id of the object that the collision happens with.  However, the function
Code: [Select]
public SimpleVector checkCollisionSpherical(SimpleVector org, SimpleVector translation, float radius)does not.  Instead it returns the vector that is safe to translate before the collision happens.

Why is the functionality different?  And is there any way I can check what object I collide with when I use checkCollisionSpherical()?

7
Support / Find an object at a 3D location
« on: April 08, 2013, 02:09:56 am »
Suppose I have a cursor in 3D space and want to perform a click.  I want to know what object the cursor is intersecting.  Is there a way to ask the world what object is at X,Y,Z location?  The checkCollision functions only check collision with the polygons of an object, so it only detects collisions on entering/exiting the object.

The best solution I can come up with is to constantly check collision whenever the cursor moves,  and keep track of entering/exiting objects. 

However, this solution isn't perfect, and I can think of many ways that this will fail.  An obvious example is that the object moves far enough away, without the cursor moving / updating, and next time the cursor moves, it doesn't realize it has left the object.

Is there any way to get the bounding box of the object?  I know you can setBoundingBox, and calculationBoundingBox, but there is no getBoundingBox, as far as I can tell.

Pages: [1]