I've gone through my code and the Kube code and they look the same!
The only thing that I can see that's different is that I use GL_FLOAT
when I define my verts and normals and the Kube program used
GL_FIXED. Could it be that the G1 doesn't support floating point
coordinates?
On Dec 3, 10:57 pm, CaseyB <[EMAIL PROTECTED]> wrote:
> I'm using the GLSurfaceView from the examples and here's all of my
> initialization code:
>
> /***********[Activity]***********/
> public class OpenGLES extends Activity
> {
> GLSurfaceView mView;
>
> /** Called when the activity is first created. */
> @Override
> public void onCreate(Bundle savedInstanceState)
> {
> super.onCreate(savedInstanceState);
> requestWindowFeature(Window.FEATURE_NO_TITLE);
>
> mView = new GLSurfaceView(getApplication());
> mView.setRenderer(new TutorialRenderer(getApplication()));
> setContentView(mView);
> }
>
> }
>
> /***********[Renderer]***********/
> public class TutorialRenderer implements GLSurfaceView.Renderer
> {
> private Context mContext;
> private boolean mCreateWorld = true;
> private Cube mCube;
> private Ship mShip;
> private float mAngle = 0;
> private int mChange = 1;
>
> public TutorialRenderer(Context context)
> {
> mContext = context;
> }
>
> @Override
> public void drawFrame(GL10 gl)
> {
> gl.glClear(GL10.GL_COLOR_BUFFER_BIT |
> GL10.GL_DEPTH_BUFFER_BIT);
> gl.glLoadIdentity();
>
> GLU.gluLookAt(gl, 0.0f, 2.0f, 2.0f, 0.0f, 0.5f, 0.0f, 0.0f,
> 1.0f,
> 0.0f);
>
> gl.glRotatef(mAngle, 0.0f, 1.0f, 0.0f);
>
> gl.glColor4f(1.0f, 0.0f, 0.0f, 1.0f);
> mCube.draw(gl);
>
> gl.glColor4f(0.0f, 1.0f, 0.0f, 1.0f);
> gl.glTranslatef(-0.25f, 0.25f, -0.75f);
> mShip.draw(gl);
>
> gl.glColor4f(0.0f, 0.0f, 1.0f, 1.0f);
> gl.glTranslatef(0.5f, -0.25f, 1.5f);
> mCube.draw(gl);
>
> gl.glFlush();
>
> mAngle += mChange;
> if(mAngle > 360) mAngle = 0;
> }
>
> @Override
> public int[] getConfigSpec()
> {
> // Need a depth buffer, don't care about color depth.
> int[] configSpec = {
> EGL10.EGL_DEPTH_SIZE,
> 16,
> EGL10.EGL_NONE};
> return configSpec;
> }
>
> @Override
> public void sizeChanged(GL10 gl, int width, int height)
> {
> gl.glMatrixMode(GL10.GL_PROJECTION);
> gl.glLoadIdentity();
>
> if(height == 0) height = 1;
> gl.glViewport(0, 0, width, height);
> GLU.gluPerspective(gl, 45.0f, 1.0f * width / height, 1.0f,
> 100.0f);
>
> gl.glMatrixMode(GL10.GL_MODELVIEW);
> gl.glLoadIdentity();
> }
>
> @Override
> public void surfaceCreated(GL10 gl)
> {
> gl.glEnable(GL10.GL_COLOR_MATERIAL);
>
> gl.glEnable(GL10.GL_LIGHTING);
> gl.glEnable(GL10.GL_LIGHT0);
>
> gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_AMBIENT, new float[]{
> 0.3f,
> 0.3f, 0.3f, 1.0f }, 0);
> gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_DIFFUSE, new float[]{
> 1.0f,
> 1.0f, 1.0f, 1.0f }, 0);
> gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_POSITION, new float[]{
> 1.0f,
> 1.0f, 1.0f, 0.0f }, 0);
>
> gl.glEnable(GL10.GL_DEPTH_TEST);
> gl.glDepthFunc(GL10.GL_LEQUAL);
>
> gl.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
> gl.glClearDepthf(1.0f);
>
> if(mCreateWorld)
> {
> createWorld(gl);
> mCreateWorld = false;
> }
>
> gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
> gl.glEnableClientState(GL10.GL_COLOR_ARRAY);
> gl.glEnableClientState(GL10.GL_NORMAL_ARRAY);
>
> gl.glEnable(GL10.GL_CULL_FACE);
> gl.glShadeModel(GL10.GL_SMOOTH);
> }
>
> private void createWorld(GL10 gl)
> {
> mCube = new Cube();
> mShip = new Ship(mContext);
> }
>
> }
>
> On Dec 3, 5:01 pm, "David Turner" <[EMAIL PROTECTED]> wrote:
>
> > the emulator only runs the Android software OpenGL renderer; while the G1
> > comes both with
> > the software renderer and a hardware-accelerated one that talks to the
> > graphics chip. Which one
> > your application will end up using depends on which GL configuration you're
> > asking for (I believe
> > that you'll get the hardware one most of the time on the G1, except if you
> > ask precisely for certain
> > configurations).
>
> > If I remember correctly, the software renderer supports features that the
> > hardware one doesn't,
> > and vice-versa (e.g. at the moment, only the hardware renderer supports
> > PBuffers). So to be able
> > to answer your question, we really need to see some of the code you're using
> > to setup your GL
> > and what you're trying to do.
>
> > On Wed, Dec 3, 2008 at 1:24 PM, CaseyB <[EMAIL PROTECTED]> wrote:
>
> > > I just got my G1 yesterday and it's an AMAZING device!! I am having a
> > > bit of trouble with it though. I have written a little OpenGL test
> > > app that runs fine in the emulator, but just shows a black screen on
> > > the G1. I can choose to run on the emulator or the G1 from eclipse
> > > and just by switching the output I can show that the code works on the
> > > Emulator and not the G1. Is there anything else (i.e. permissions,
> > > etc,) that I need to have it run on the G1?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---