# thanalas

Member

7

122 Neutral

• Rank
Newbie
1. ## floating point & fixed point again

As you have said, the Tutorial on this site shows a one line macro for converting integers to fixed point, and the BREW site, if you choose the basic programming link or something, has a similar macro for converting floating point to fixed point. Now, I find the rest of what you are saying to be quite interesting. First, whether it is an integer or a floating point value, the process is the same for both the macros I mentioned above, they just multiply the value by 2^16, but in the case of floating point, it takes only the non-fractional portion. Now, when I first started working with the colors and vector values in GL ES, I found that things only worked out if I changed the macros to multiply by 2^8. I'm not certain why this is the case, as I cannot imagine that the BREW website would have the wrong macro for conversion, but perhaps someone should send a message to the OpenGL ES people, khronos or whatever. Personally, I would stick to 2^8, otherwise all the values you send will be taken as being at minimum 256 times larger than what you intended.
2. ## Simple Color Problems

Really? I thought that all the values passed to OpenGL ES functions had to be GL_FIXED. I know that with a PC you could pass UNSIGNED, but I thought that was one of the key points to ES
3. ## To Texture or Not?

Just wanted to do a quick survey, Since this thing is running at 320x240, and has 16bit max color depth, do you think that using textures is actually going to be any better than just using straight colors on the vertices? Personally I think just colors, as we are talking about 3 extra values per vertex (only 1 extra if you are clever), as opposed to needing 2 for the texture coordinates, plus the space the texture will occupy. I'd say that a model at a distance that would be reasonable on the PC, will end up consisting of maybe 500 pixels, which means that the texture on the left boot of this model will probably only be 50 pixels. This means that a texture any larger than 10x10 would be overkill for what you are getting out of it.
4. ## Simple Color Problems

Nevermind my previous babble. The problem is that GL by default wants the values as 0-1, but I seem to have had some problems with my floating point conversion macro, and so by making a new integer conversion macro that uses 2^8 instead of 2^16, I have simple made my integers into fractions. 255*2^8 = 2^16 (approximately)
5. ## Simple Color Problems

Thanks for the suggestion about checking the values Palidine, the debugger will definitely tell me what the hell is happing here.
6. ## Simple Color Problems

Alright, I seem to have solved the problem, at least to some extent. If you make an additional conversion macro like such: #define ITOFP2(x) ((x)<<8) and use this to convert your RGB values, assuming that the values range from 0 to 255 with 255 being full saturation. This ends up working quite well, but it assumes a few things that seem very strange, first it assumes that GL is taking the values from 0 to 255 rather than 0 to 1, which I guess is the case. Although more perturbing is the fact that it is only moving 8 places, suggesting a possible problem with the assumption that BREW uses 16.16 fixed point values.
7. ## Simple Color Problems

I seem to be having some problems controlling the colors of my vertices. The problem is this: OpenGL as far as a can remember from my old days of programming, requires that the color values range from 0 to 1, with 1 being the equivalent of 255 in the old way of defining the value of a color (that is 8bit Red, 8bit Green, 8bit Blue, 8bit Alpha). Anyway, the problem is that both the GameDev tutorial and the BREW stuff automatically get all happy about their integer to fixed point converter, which in this case is totally useless, as it means that only 9 distinct colors are actually possible. Now, if I decide to make my colors into floating point values and then pass them into GL as fixed point values, it seems to just assume that any value other than 0, is in fact 1, which puts me back at the initial problem. Has anyone else encountered this problem? And more importantly, has anyone been able to utilize the full color spectrum that should be available?