Hello everyone,

Again, right upfront... I have to admit to being brand new to Java and
OOP (though not to structured programming) and I'm drowning a bit...

>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 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 Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to