(I did post this to the beginners group, but it's been several days
without response. Let me know if a double post like this is frowned
upon... It feels like a basic question, but anyway...)

Hello everyone,

>From digging around a bit, getAssets() is an inherited method from
ContextWrapper. It returns an AssetManager, and using open() it can
return an InputStream.

What I'm attempting to do at this point, is use the
GLSurfuceViewActivity, Cube and CubeRenderer to work and learn off of
and read in vertex data from a binary file. I've already created the
binary output by parsing a model obj file and added to the assets
directory.

My Shape class (modified from the Cube class) does not have access to
calling getAssets() since it's not a subclass of Activity or
ContextWrapper. Once I accepted that, I tried to think of the best way
to read in the data (without storing it extra places) to the Shape
class.

What I did, and seems to be working okay, was modify the Shape and
ShapeRenderer constructors to accept an AssetManger as a parameter. In
the main Activity I added a private AssetManager, instatiated it in
the onCreate() method from the main Activity, and passed that into the
Renderer like so:

am = getAssets();
mGLSurfaceView.setRenderer(new ShapeRenderer(am));

Does this sound reasonable or totally off base?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to