I use code similar to this for my step 2.

http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/graphics/spritetext/LabelMaker.html

The whole SDK example is there under the spritetext
http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/graphics/spritetext

First it draws a textured triangle and then draw sprite text. But it
is all done in same step.

It does use canvas and opengl. It creates a texture image for the
text. After going through SDK examples I figured this is right way to
draw text in openGL?

In step 1 of my code, I use colorbuffer, vertexbuffer and drawelements
functions of GL10. In step 2 I use code similar to LabelMaker.java to
print text on top of the screen.

Dianne, The reason I separated step 2 from step 1 is because nothing
works if I do step 1,2 in the same frame. Atleast separting step1 from
step2 I can get code to work properly on 2.1 and 2.2 that are 90% of
android users.

Veritatis,
I don't have access to any other 2.3.3 phones yet, but I did visually
verify on a friend's phone (2.3.3 gingerbread) that my code throws
random colors onto the screen when it is time for step 2. When you say
openGL supports rendering text, are you referring to openGL 2.0? I am
using openGL 10 at the moment and didn't want to take a leap into open
GL20 in my first app. But if openGL 2.0 is the way to go for rendering
text in a opengl frame I am open to moving to that platform and I
might have to eventually do that for all my future apps.




On May 16, 1:19 pm, Dianne Hackborn <[email protected]> wrote:
> Oh sorry I missed that he was trying to mix Canvas drawing with OpenGL.  If
> so...  yes, do not do that.  The result is undefined.  Increasingly a
> drawing target for OpenGL will be in some wacky frame buffer layout that
> makes sense for the hardware, so can't be touched sanely with software
> drawing.  The memory of the framebuffer may not even be visible to the CPU.
>
> So it's more than not a good idea to do this, it is fundamentally broken to
> do so.  The results you see will vary across different devices and hardware
> depending on how they work internally.
>
> On Mon, May 16, 2011 at 8:08 PM, Indicator Veritatis <[email protected]>wrote:
>
>
>
>
>
>
>
>
>
> > It is not a good idea to mix on the same surface, draws using OpenGL
> > and draws using the SDK's graphics. That is asking for confusing bugs
> > -- like what you are seeing. Nor should it be necessary, as OpenGL
> > supports drawing text.
>
> > That said, I cannot assert with any certainty that this is the cause
> > of your problem. You have too many variables: varying SDK, varying
> > hardware platform. But I do have to echo Dianne's observation that SDK
> > version has little or nothing to do with OpenGL version. I won't go as
> > far as to say 'nothing', since as I recall, the latest version of the
> > SDK supports a later version of OpenGL (or was is ES? I forget) than
> > 1.5 and 1.6 did. But your posts make it sound like the real problem
> > has nothing to do with SDK version, and much more likely everything to
> > do with the OEM's implementation of the device dependent primitives
> > OpenGL relies on. Is it really only on the Nexus that you see the
> > failure? Have you tried 2.3.3 on another phone or in the simulator?
>
> > On May 16, 10:49 am, Leo <[email protected]> wrote:
> > > Hi Dianne,
>
> > > I will post a sample code in android sometime soon. I have problem in
> > > my opengl app: Basic logic is as follows:
>
> > > drawframe()
> > > {
> > > if (time < 400) {
> > >   // step 1
> > >   drawobjects();} else if (time < 800) {
>
> > >   //step 2
> > >   draw sprite text();
>
> > > }
> > > }
>
> > > I first draw the text using GL10 in step 1, then I use the SDK sprite
> > > text to draw some notification text. I don't clear the screen between
> > > steps 1 and 2. The code Works perfectly on android 2.1 and 2.2 (in
> > > step 2 I can see perfectly the objects and the text), but on 2.3.3
> > > nexus only step 1 works when I get to the portion about draw text
> > > (step 2) it throws all sorts of random colors on the screen.
>
> > > My minsdkversion is 4 (version 1.6). I haven't specified a target sdk
> > > version yet.
>
> > > I was wondering if I need to step into 2.3.x android framework code to
> > > debug this or just file a sample app code illustrating the problem and
> > > post it as a bug. Would you recommend I post the sample code as a bug
> > > ticket?
>
> > > -Leo
>
> > > On May 13, 5:52 pm, Dianne Hackborn <[email protected]> wrote:
>
> > > > GL10 has nothing to do with SDK version.  I really don't understand
> > what you
> > > > are asking in relation to that.
>
> > > > You set the minSdkVersion to the minimum number you will run on.
> >  Market
> > > > will filter your app from older versions of the platform.  You set
> > > > targetSdkVersion to the newest version you have tested on.  This allows
> > > > newer versions of the platform to turn off compatibility features on
> > your
> > > > app, many of which are described in the page I pointed to.
>
> > > > On Fri, May 13, 2011 at 9:21 PM, Leo <[email protected]> wrote:
>
> > > > > Hi Dianne,
>
> > > > > That page lists what each version number's code name is but that is
> > > > > not I am seeking.
>
> > > > > I have more fundamental question.
>
> > > > > Say if I have opengl GL10 calls in my app and I have set minSDK level
> > > > > to 4 and targetSDK level 5 in my manifest and the app runs on a phone
> > > > > that has 2.3 Gingerbread where do the opengl library code get pulled
> > > > > from
>
> > > > > level 3, level 4 or gingerbread.
>
> > > > > In particular I am wondering what are parameters to consider when
> > > > > setting minSDK level and targetSDK level if I am interested in
> > > > > targeting 2.1 and 2.2 and 2.3+ users.
>
> > > > > If I released an app with min SDK level 4, can I then change the min
> > > > > SDK level to higher number in upgrades or I am stuck with min SDK
> > > > > level 4 for the lifetime of the app?
>
> > > > > Thanks,
> > > > > Leo
>
> > > > > On May 13, 1:57 pm, Dianne Hackborn <[email protected]> wrote:
> > > > > > The mappings between code names, version numbers, and API levels is
> > here:
>
> >http://developer.android.com/reference/android/os/Build.VERSION_CODES...
>
> > > > > > On Fri, May 13, 2011 at 8:55 PM, Leo <[email protected]> wrote:
>
> > > > > > > Can somebody clarify where the java libraries get pulled from
> > with
> > > > > > > regard to
>
> > > > > > > Min SDK version vs target SDK version vs actual device android
> > > > > > > version.
>
> > > > > > > When compiling in SDK I see min SDK version android*.jar getting
> > > > > > > pulled into referenced libraries by the eclipse plugin. But how
> > does
> > > > > > > that referenced library relate to the libraries specified in
> > target
> > > > > > > SDK and the version of android running on device is a little
> > unclear
> > > > > > > to me.
>
> > > > > > > By library - I mean android framework classes that are needed to
> > run
> > > > > > > the app.
>
> > > > > > > --
> > > > > > > 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
>
> > > > > > --
> > > > > > Dianne Hackborn
> > > > > > Android framework engineer
> > > > > > [email protected]
>
> > > > > > Note: please don't send private questions to me, as I don't have
> > time to
> > > > > > provide private support, and so won't reply to such e-mails.  All
> > such
> > > > > > questions should be posted on public forums, where I and others can
> > see
> > > > > and
> > > > > > answer them.
>
> > > > > --
> > > > > 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
>
> > > > --
> > > > Dianne Hackborn
> > > > Android framework engineer
> > > > [email protected]
>
> > > > Note: please don't send private questions to me, as I don't have time
> > to
> > > > provide private support, and so won't reply to such e-mails.  All such
> > > > questions should be posted on public forums, where I and others can see
> > and
> > > > answer them.
>
> > --
> > 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
>
> --
> Dianne Hackborn
> Android framework engineer
> [email protected]
>
> Note: please don't send private questions to me, as I don't have time to
> provide private support, and so won't reply to such e-mails.  All such
> questions should be posted on public forums, where I and others can see and
> answer them.

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