I have a class called ScreenView that extends GLSurfaceView.
I have another class called ScreenRenderer that
implements GLSurfaceView.Renderer.

On ScreenView constructor I do the following:
screenRenderer = new ScreenRenderer(context);
setRenderer(screenRenderer);

On onTouchEvent (in ScreenView) I set a flag during ACTION_DOWN to know that
the user touched the screen (first IF on my first e-mail).

I don't have other threads running at this moment.

Thanks,



Thiago


On Fri, Sep 3, 2010 at 14:38, Robert Green <[email protected]> wrote:

> Thiago,
>
> I would not expect to see those drawn.  Your color/depth clear should
> take care of it.  You're using a GLSurfaceView and drawing only in the
> renderer which is called by the view, right?
>
> I suppose I'd try a flush before the actual rendering pass but that
> shouldn't be necessary either.
>
> What is your thread configuration?  Doing anything special there?
>
> On Sep 3, 11:33 am, Lance Nanek <[email protected]> wrote:
> > Weird, even if the command queue filled up and some were sent to the
> > hardware automatically, that shouldn't cause a buffer swap, which must
> > have happened for you to see things in progress...
> >
> > On Sep 2, 3:50 pm, Thiago Lopes Rosa <[email protected]> wrote:
> >
> >
> >
> > > Hi,
> >
> > > I have a 3D game and I am using color-picking to know which object was
> > > selected.
> >
> > > When the user touches the screen, I draw each object with a different
> color.
> > > Then I read the color where the user touched the screen to know which
> object
> > > was selected. After that I draw each object with their respective
> > > textures/colors. (everything done during one onDrawFrame pass)
> >
> > > The problem is that sometimes the colored objects appear on the screen
> (~5%
> > > of the times the user touches the screen) and it is even worse on
> slower
> > > hardwares.
> >
> > > This is my pseudo code:
> >
> > > public void onDrawFrame(GL10 gl) {
> > > if (user touched the screen) {
> > >  gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
> > >  gl.glMatrixMode(GL10.GL_MODELVIEW);
> >
> > > // DRAW COLORED OBJECTS
> >
> > > gl.glReadPixels(x, y, ......);
> > >  // CHECK WHICH OBJECT WAS SELECTED
> > >  gl.glColor4x(0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF);
> > >  }
> >
> > >  gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
> > >  gl.glMatrixMode(GL10.GL_MODELVIEW);
> >
> > >  // DRAW TEXTURED OBJECTS
> >
> > > }
> >
> > > As far as I understand, we always draw on the Back Buffer and only
> after we
> > > finish, it swaps to the Front Buffer and updates the screen.
> > > Is there anything wrong with the above code?
> >
> > > Thanks!
> >
> > > Thiago
>
> --
> 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]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

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