[Q] opengl text rendering and glPixelTransfer - Android Software Development

Hi,
I noticed that there is no glPixelTransfer() function available (at least that's what eclipse tells me). I'm using API level 4, is it perhaps available in a later API?
What I'm doing is creating textures of single characters using a TTF file as they are requested and drawing them side by side. This works great, its quick and I can use any custom font.
The problem is that I can only make them one colour (the colour that they are drawn with when the texture is created). Before I started doing this I figured I would be able to draw them black and just use glPixelTransfer() to set the colour biases for the desired colour when I draw them. However now I find that glPixelTransfer() isn't available.
Does anyone know if there is an alternative that will do a similar thing or is there another way to draw text in opengl? I suppose I could create multiple textures of a character with specified colours. But would that be too memory heavy?
To be clear, I'm not creating a texture of every character at the beginning of the app. I'm creating the textures when they are requested and reusing them when they are requested again. So it isn't very resource intensive and creating multiple versions of a character with different colours (as they are requested) would maybe be acceptable also.
I suppose I just want your input in case I'm doing this a much more difficult way than is necessary .
Thanks for any input.

d47 said:
Hi,
I noticed that there is no glPixelTransfer() function available (at least that's what eclipse tells me). I'm using API level 4, is it perhaps available in a later API?
What I'm doing is creating textures of single characters using a TTF file as they are requested and drawing them side by side. This works great, its quick and I can use any custom font.
The problem is that I can only make them one colour (the colour that they are drawn with when the texture is created). Before I started doing this I figured I would be able to draw them black and just use glPixelTransfer() to set the colour biases for the desired colour when I draw them. However now I find that glPixelTransfer() isn't available.
Does anyone know if there is an alternative that will do a similar thing or is there another way to draw text in opengl? I suppose I could create multiple textures of a character with specified colours. But would that be too memory heavy?
To be clear, I'm not creating a texture of every character at the beginning of the app. I'm creating the textures when they are requested and reusing them when they are requested again. So it isn't very resource intensive and creating multiple versions of a character with different colours (as they are requested) would maybe be acceptable also.
I suppose I just want your input in case I'm doing this a much more difficult way than is necessary .
Thanks for any input.
Click to expand...
Click to collapse
ok first of all i am not an openGL expert so if what im saying is crazy feel free to say so .
BUT, couldnt u just use the glColor**() function to apply a colors mask over the txts ur drawing?

jug6ernaut said:
ok first of all i am not an openGL expert so if what im saying is crazy feel free to say so .
BUT, couldnt u just use the glColor**() function to apply a colors mask over the txts ur drawing?
Click to expand...
Click to collapse
No, that won't work. glColor() only applies to subsequent calls to glVertex().
The characters I'm drawing are bitmaps and are just painted as is onto an object surface.
The only way I am aware of that can change the colour of a bitmap is with glPixelTransfer().
I've made it so it now loads multiple coloured versions of characters and it works fine, but I don't like it

Related

Horizontal seperator lines on Today screen…

Is there any way to get rid of them or to make them transparent?
Something I have tried time and time again to find out. There was a program called Pocket Facelift, which either got rid of them or cloned the today screen and superimposed an image over the top without the lines. I've searched for registry entries, hacks and cracks. Everything. Never been able to find it.
I still wish someone would produce a low memory footprint version of a screen that say the later Nokias and Samsungs have, where all the information about the phone is held in the corners (battery, SMS, signal, etc), leaving the rest of the screen for the picture (without lines).
Cheers
Ant
Anton.Valleyman said:
Something I have tried time and time again to find out. There was a program called Pocket Facelift, which either got rid of them or cloned the today screen and superimposed an image over the top without the lines. I've searched for registry entries, hacks and cracks. Everything. Never been able to find it.
I still wish someone would produce a low memory footprint version of a screen that say the later Nokias and Samsungs have, where all the information about the phone is held in the corners (battery, SMS, signal, etc), leaving the rest of the screen for the picture (without lines).
Cheers
Ant
Click to expand...
Click to collapse
Thanks...
Anton.Valleyman: when you say "low memory", I guess WDA is out of the question
I hadn't seen Facelift before. The page seems to suggest that Facelift may be a replacement Today plugin host:
Today screen scrolling is fully supported. The today screen plugins are resized in order to avoid covering information by the scroll bar.
Click to expand...
Click to collapse
Resizing Today plugins requires some messy coding or hosting plugins yourself. That might explain how they get rid of the seperator lines - if you host the plugins yourself, you obviously don't have to draw the lines... that's just a theory though!
still wish someone would produce a low memory footprint version of a screen that say the later Nokias and Samsungs have, where all the information about the phone is held in the corners (battery, SMS, signal, etc), leaving the rest of the screen for the picture (without lines).
Click to expand...
Click to collapse
My unreleased VJEphemeris is entirely skinnable, and I'm trying to design it around a thumb friendly design. I want to use the corners in the way you described... but your idea is a good one, a nice clean full screen today plugin just showing basics, operator logo and a wallpaper is a nice idea...
For the lines, I just suggest you choose a color similar to your background. I use a plain white wallpaper, so easy for me
It might be feasible to do some hairy hacking to subclass the today screen and intercept the line drawing function, but I don't recommend it as an easy solution :shock:
V

[REQ] Help to create text and walk app

I am looking for some help from the many people on here more talented than me, I have very basic programing skills but am hoping to learn more though this process.
The plan : Create an app for winmo that can do similar to this http://www.theregister.co.uk/2009/05/14/email_n_walk/ ideally for texting as well as email.
My ideas so far (very early stages):
1. Use the generic windows messaging screen and replace the white standard background with a transparent one, probably with shaded area for tx to make it readable, and call the camera app behind it.
2. Use the tf3d messaging screen and use something like MunBackground all tabs to again run the camera view instead of a static picture.
In an ideal world I would only like to use one of these methods meaning that text/email could be written with or without the camera app running.
I would appriciate any input and help with this, I am well aware this will be made more difficult with my lack of experience, but am hopful that the wealth of knowlege here can help.
Im sorry, i cant offer my help, but you have my support; this would be great, especially for wvga devices.
If I understanded, you want transparent screen to send messages?
I'd be willing to donate some money toward anyone who could create such an application.
I'm sure came across this before as an idea if i'm reading it correct, the problem being that when we walk we don't hold the phone up infront so we'd be viewing the floor infront of our feet
One way would be to take a picture every x ms and draw it and additional items like rectangles and text in the paint method of a panel control.
P.S.: How would it look like in manila? Remember this fake/bug live camera image in home screen?
bug description
stylez said:
I'm sure came across this before as an idea if i'm reading it correct, the problem being that when we walk we don't hold the phone up infront so we'd be viewing the floor infront of our feet
Click to expand...
Click to collapse
Possibly not completely upright, but maybe 45 deg, and would still stop you tripping over stuff!!
heliosdev said:
One way would be to take a picture every x ms and draw it and additional items like rectangles and text in the paint method of a panel control.
P.S.: How would it look like in manila? Remember this fake/bug live camera image in home screen?
bug description
Click to expand...
Click to collapse
In my head, it would ideally be a seperate way of opening/writing text/email to save battery life when not needed, and would probably be a video/camera image behind, with a semi transparent overlay/greyed out area where message text was typed to enable the text to be readable.
Will try out that diamond bug/fake

HTC Diamond2, WM6.5 Change Resolution

I have recently bought an HTC Diamond2 and upgraded its ROM to the official WM6.5, still using TouchFLO 3D. I have set the character size to the largest available size (through Settings), yet the character size in 'Contacts', SMS text and the digits when I dial a phone number is too small for my eyes.
Is there a Registry Tweak or Utility to further increase the character/font size?
I use a utility from here to zoom in/out text from SMS text, which is good but not adequate (NB that no sliding bars appear for the text to be read properly but...).
In addition, mine is bought from the Netherlands, yet I installed the official Greek WM6.5 ROM.
I tried RealVGA, but a single DPI is available (hence useless).
Thanks in advance for any information.
there is a magnifying program for the phone. Maybe this is something for you?
scorpower said:
there is a magnifying program for the phone. Maybe this is something for you?
Click to expand...
Click to collapse
i believe the real life application: "reading glasses" might also be appropriate here
jokes aside, magnification programs are easy to use. search for them in this forum. a few available i think.
I do own the real-life application "reading glasses"; the problem is that when I am about and the phone rings, it is not easy to take the 'application' out of my pocket and 'run' it.
I have also installed the Zoom In/Out application for SMS.
Nevertheless I am surprised there is no information on how to change the character DPI under WM6.5 or the screen resolution.
Thank you again for your answers
The fontsize from the SMS tab can be found in a _manila-File.
But i forgot in which file... You could ask a rom cook, who build in a biger SMS font.
I changed the font on Manila 2.1, but not on 2.5 with Mode9 editor.
greets, Inselstaat
pfoul said:
I do own the real-life application "reading glasses"; the problem is that when I am about and the phone rings, it is not easy to take the 'application' out of my pocket and 'run' it.
I have also installed the Zoom In/Out application for SMS.
Nevertheless I am surprised there is no information on how to change the character DPI under WM6.5 or the screen resolution.
Thank you again for your answers
Click to expand...
Click to collapse
Try this:
http://forum.xda-developers.com/showthread.php?t=551611
You can just use the slider to enlarge the text in SMS and emails.
As far as the system text.... maybe Advanced Config?
Thank you, but the proposed application does not run for some reason (I have install the latest mobile .net framework (version 3.7). Should I use 3.5 instead?
As for the last reply, I have set the character size to maximum from the Settings, but they are too small due to the small screen size compared to the resolution.
Judging from a LG GT500 I would say that a resolution of about 320x200 (or slightly higher) would be alright, but I know neither the Registry setting (if one is available) or a working application that can do the trick.
Thanks again for the replies though.
Try NET CF v3.5.

[Q] Live Wallpaper Falling Images and Sizes

I am wondering how to take a bitmap image and have it drop vertically from the top of the screen to the bottom and then wrap and do it again. I can only find how to rotate it around a certain access in the help portions. I'm assuming we can use different speeds as well to do the dropping. Also, what sizes need to be set in the hdpi and so forth? It seems that 920x740 is way to big of a picture for that folder and would be a memory hog.
I've not done any wallpapers apps, but typically, to do what you intend, you'd create a thread (class derived from java.lang.Runnable) with a simple loop and a wait timer (call Thread.sleep(). As the loop iterates, send a message to a class derived from android.os.Handler. In the handler, update your coordinates and refresh your view with view.invalidate().
What has it drop? I'm curious how you have your program realize it needs to drop down and then wrap around. All I understand is how to make it rotate around a set axis point.
bearcatext said:
What has it drop? I'm curious how you have your program realize it needs to drop down and then wrap around. All I understand is how to make it rotate around a set axis point.
Click to expand...
Click to collapse
You're thinking at too high level. There is no built in api for falling objects or animating bitmaps, you need to do it yourself.
The way I do it on my doom live wallpaper is to create a java object for each character or projectile I want to draw. The object contains variables for current x and y coordinates on screen and a method to update the position for a new frame.
That makes sense, that is what I was thinking on my drive home today that maybe all it was is setting the x or y coordinates and subtracting or adding depending on how you want it to look. Thanks for the response though I think this is the second time you've helped me out so I appreciate it.

Need Some help with layout in calculator app

i have attached a picture here
1.) how do i set the buttons so that they look uniform throughout different devices (screen size , tablets etc) right now they look different on the emulator and on a device
2.)i also need some help in implementing some code like when i press Shift Button and then press a button it will alternate between functions of that button .. please guide me on how to implement this ?
also is there an easier way to implement a custom grid of buttons rather than using relative layout for all buttons i have looked into gridview but do not know how to customize it ?
please help .. thanks
Make linearlayouts for every row with height wrap and width match. Now for every child button of that linear layout set width as match parent and height wrap_content.and also add another line in all the buttons android:layout_weight="1"
There can be another approach as well. You can use table layout which is easy. You can find guides on Google for it
Sent from my XT1033 using XDA Premium 4 mobile app
arpitkh96 said:
Make linearlayouts for every row with height wrap and width match. Now for every child button of that linear layout set width as match parent and height wrap_content.and also add another line in all the buttons android:layout_weight="1"
There can be another approach as well. You can use table layout which is easy. You can find guides on Google for it
Click to expand...
Click to collapse
Agreed, use a TableLayout (containing multiple TableRows. I suggest reading this doc about creating a table.
umartariq94 said:
1.) how do i set the buttons so that they look uniform throughout different devices (screen size , tablets etc) right now they look different on the emulator and on a device
2.)i also need some help in implementing some code like when i press Shift Button and then press a button it will alternate between functions of that button .. please guide me on how to implement this ?
also is there an easier way to implement a custom grid of buttons rather than using relative layout for all buttons i have looked into gridview but do not know how to customize it ?
Click to expand...
Click to collapse
A totally different option to consider here would be using a KeyboardView instead! That way you won't have to deal with all the buttons (and I think the shift function might be easier as well). As it happens, I wrote a guide on how to implement such a custom keyboard a while ago . You just have to make the KeyboardView a little larger and delete the part where the back key hides it. Be warned though, this class is highly undocumented and it's not guarenteed everything is working the way it should.
Thanks for the replies !

Categories

Resources