Главная » Просмотр файлов » Wiley.Games.on.Symbian.OS.A.Handbook.for.Mobile.Development.Apr.2008

Wiley.Games.on.Symbian.OS.A.Handbook.for.Mobile.Development.Apr.2008 (779888), страница 54

Файл №779888 Wiley.Games.on.Symbian.OS.A.Handbook.for.Mobile.Development.Apr.2008 (Symbian Books) 54 страницаWiley.Games.on.Symbian.OS.A.Handbook.for.Mobile.Development.Apr.2008 (779888) страница 542018-01-10СтудИзба
Просмтор этого файла доступен только зарегистрированным пользователям. Но у нас супер быстрая регистрация: достаточно только электронной почты!

Текст из файла (страница 54)

The spec for OpenGL ES 2.0was only finalized in March 2007, so it’s probably going to be a whilebefore we see support in phones – although having said that, ImaginationTechnologies’ PowerVR SGX GPU series is already OpenGL ES 2.0 compliant, and they have already released an SDK for PC emulation.9 Giventhat standards are always evolving to meet new challenges, it shouldn’tbe long until Symbian smartphones support this amazing technology;Symbian has penciled in Symbian OS v9.5 as the one that delivers areference implementation of OpenGL ES 2.0. I just hope it’s not too long,because when we get hardware accelerated 3D graphics using shaders,it’s going to make a lot of FlashLite games look ‘so 2007’!7.9 Get Your FixWhile it’s all very well to go on about how good all these standards are,I wanted to finish off on a slightly different note.

This section doesn’t talkabout any standard in particular, but I thought it would be appropriate topresent a quick discussion of fixed point numbers, since they play suchan important part in OpenGL ES development.As we’ve already said, many manufacturers don’t put FPUs in handsetsdue to increased production costs and power constraints. Conversely,sometimes FP calculations are emulated in software instead – but theseare too slow to be useful in games; even if they weren’t, their powerconsumption is also prohibitive – a rather interesting Catch-22.So the solution is fixed point mathematics – using integer arithmeticto yield decimal results.

But like everything in life, it comes with a price;what you gain in speed, you lose in precision and in representationalrange. After all, an integer is not a decimal, so clearly an approximaterepresentation needs to be employed.A decimal number consist of two parts – the integral part to the leftof the decimal point, and the fractional part to the right. Now, in afixed point representation, the location of the decimal point is fixed(wow – how insightful). So if you have a number made up of N bits9The SDK can be found at www.imgtec.com/PowerVR/insider/toolsSDKs/KhronosOpenGLES2xSGX.GET YOUR FIX235and you use M bits for the integral part, you have N-M bits left over torepresent the fractional part.You’ll also want to be able to represent negative numbers so the integral portion is in fact a 2’s complement number with the most significantbit used as the sign bit.

If we use a 32-bit integer and reserve the bottom16 bits for the fractional part, we say that we have either a 16.16 fixedpoint number or an S15.16 fixed point number (where the ‘S’ indicatesthe sign bit).Now let’s see what this looks like. In fixed point arithmetic, all the digitsto the right of the ‘decimal’ point are multiplied by negative exponentsof the base.

Sounds scary, so check this out this representation of π inbase 10:(3.14159)10 = 3 * 100 + 1 * 10−1 + 4 * 10−2 + 1 * 10−3 + 5 * 10−4 + 9 * 10−5= 3 +0.1 +0.04 +0.001 +0.0005 +0.00009Makes sense doesn’t it? Now let’s convert another example expressedusing base 2:(110.01000)2 = 1 * 22 + 1 * 21 + 0 * 20 + 0 * 2−1 + 1 * 2−2 + 0 * 2−3 +* 2−4 + 0 * 2−5= 4 +2 +0 +0 +1/4 +0 + 0 + 0= 6.25But wait! This is a binary number, so we can do bit ops, like shifting,on it. So let’s get rid of the fractional part by shifting left by 5. We nowhave 11001000 which is equal to 200. It doesn’t matter whether weuse binary or decimal, the result is the same, so we can now say that6.25 = 200 5.

And, whacko, we’ve represented a decimal number byusing an integer with a bit shift.The final piece of cleverness is that if you’re using a fixed format suchas 16.16, which is what OpenGL ES uses, you know that you’ll always beshifting right or left by exactly 16 bits. This is the same as multiplying ordividing by 216 = 65536 respectively, and should explain the meaningof the following four macros found in utils.h in the S60 SDK OpenGLES examples:#define INT_2_FIXED(__a) (((GLfixed)(__a))<<16)#define FIXED_2_INT(__a) ((GLint)((__a)>>16))#define FLOAT_2_FIXED(__a) ((GLfixed)(65536.0f*(__a)))#define FIXED_2_FLOAT(__a) (((GLfloat)(__a))* (1/65536.0f))You should be able to see for yourself that the normal arithmeticaloperations like addition and multiplication are actually performed asinteger operations, which are obviously a lot faster.236 C/C++ STANDARDS SUPPORT FOR GAMES DEVELOPERS ON SYMBIAN OSHowever, a word of caution is in order here: in non-trivial calculations,the danger lies in temporary results occasionally being inexpressible inthe fixed point format being used – this can happen when there are notenough digits to express the number (overflow), or when the number istoo small to be represented (underflow).Now that you know a bit about fixed point arithmetic, it’s worthremembering that the Symbian OS build tools will build user-side code asThumb unless you tell them not to by using the BUILD_AS_ARM specifierin your bld.inf file, or the ALWAYS_BUILD_AS_ARM keyword in theproject MMP.A key benefit of using the ARM instruction set when using fixedpoint numbers is that you get ‘free’ support for bit shifting using theASR (arithmetic shift right) and the LSL and LSR (logical shift left/right)instructions.

This is because while these instructions are also present in theThumb instruction set, under ARM, the bit-shift ops can be piggy-backedinto another instruction such as MOV, ADD, SUB and so on; therefore, theshift doesn’t have any impact on the instructions’ execution time. Clearly,this can translate into a huge performance gain when you’re heavilyusing fixed point arithmetic for physics simulations and 3D renderingusing libraries such as Mascot or OpenGL ES.Hopefully, this brief introduction will help you use the GLfixed datatype and APIs in OpenGL ES.

For a thorough treatment of fixed pointarithmetic, refer to [2] and [3] in the Further Reading section below.7.10Enough Already!We’ve covered a lot of ground in this chapter, and it doesn’t have codein it to break it up so, if you got this far, well done! You may havealso noticed that, while the chapter title is ‘C/C++ Standards Support forGames Developers on Symbian OS’ there was nothing on support forstandard C++ libraries like the STL.

At the time of writing, there is noofficial support for standard C++ on Symbian OS, although there are anumber of unofficial versions.As regards POSIX, it’s also unlikely that Symbian OS is going tointroduce support for select, fork, exec or signal in the shortor medium term, without a significant re-design of some of the coreoperating system parameters.

Regardless, there is nearly always a wayaround the problem, outlined in detail by the guys who built P.I.P.S.in the Using P.I.P.S. booklet from Symbian Press, found at developer.symbian.com/main/learning/press/books/pdf/P.I.P.S..pdf.Symbian OS has evolved over time to meet a wide variety of industrystandards while maintaining its position as the premier mobile phoneoperating system, which is no mean feat. This support should makeporting games to Symbian OS a fairly easy task both now and in theFURTHER READING237future.

But if you’re considering the use of a middleware solution to easethe effort of porting between different platforms, you should turn to theAppendix on Ideaworks3D’s Airplay SDK, found at the end of this book.7.11 Further Reading[1] Core Techniques and Algorithms in Game Programming, D.

SanchezCrespo Dalmau. New Riders, 2003.[2] Mobile 3D Graphics, A. Malizia. Springer-Verlag, 2006.[3] OpenGL ES Game Development, D. Astle and D. Durnil. PremierPress, 2004.8The N-Gage PlatformPeter Lykke Nielsen and Roland Geisler (Nokia)Jo Stichbury8.1 A Brief History of N-GageMention the N-Gage ‘game deck’ mobile device by Nokia to anyone whohas worked in mobile games, and you’ll find they have an opinion.

TheN-Gage devices continue to polarize opinions – people either love themor hate them!As a mobile device manufacturer, Nokia has always been committedto mobile games. It was the first manufacturer to put a game, Snake, ontoa mobile device, back in 1997. Nokia found that the game caught onand quickly became popular.

Характеристики

Тип файла
PDF-файл
Размер
2,71 Mb
Материал
Тип материала
Высшее учебное заведение

Список файлов книги

Свежие статьи
Популярно сейчас
Как Вы думаете, сколько людей до Вас делали точно такое же задание? 99% студентов выполняют точно такие же задания, как и их предшественники год назад. Найдите нужный учебный материал на СтудИзбе!
Ответы на популярные вопросы
Да! Наши авторы собирают и выкладывают те работы, которые сдаются в Вашем учебном заведении ежегодно и уже проверены преподавателями.
Да! У нас любой человек может выложить любую учебную работу и зарабатывать на её продажах! Но каждый учебный материал публикуется только после тщательной проверки администрацией.
Вернём деньги! А если быть более точными, то автору даётся немного времени на исправление, а если не исправит или выйдет время, то вернём деньги в полном объёме!
Да! На равне с готовыми студенческими работами у нас продаются услуги. Цены на услуги видны сразу, то есть Вам нужно только указать параметры и сразу можно оплачивать.
Отзывы студентов
Ставлю 10/10
Все нравится, очень удобный сайт, помогает в учебе. Кроме этого, можно заработать самому, выставляя готовые учебные материалы на продажу здесь. Рейтинги и отзывы на преподавателей очень помогают сориентироваться в начале нового семестра. Спасибо за такую функцию. Ставлю максимальную оценку.
Лучшая платформа для успешной сдачи сессии
Познакомился со СтудИзбой благодаря своему другу, очень нравится интерфейс, количество доступных файлов, цена, в общем, все прекрасно. Даже сам продаю какие-то свои работы.
Студизба ван лав ❤
Очень офигенный сайт для студентов. Много полезных учебных материалов. Пользуюсь студизбой с октября 2021 года. Серьёзных нареканий нет. Хотелось бы, что бы ввели подписочную модель и сделали материалы дешевле 300 рублей в рамках подписки бесплатными.
Отличный сайт
Лично меня всё устраивает - и покупка, и продажа; и цены, и возможность предпросмотра куска файла, и обилие бесплатных файлов (в подборках по авторам, читай, ВУЗам и факультетам). Есть определённые баги, но всё решаемо, да и администраторы реагируют в течение суток.
Маленький отзыв о большом помощнике!
Студизба спасает в те моменты, когда сроки горят, а работ накопилось достаточно. Довольно удобный сайт с простой навигацией и огромным количеством материалов.
Студ. Изба как крупнейший сборник работ для студентов
Тут дофига бывает всего полезного. Печально, что бывают предметы по которым даже одного бесплатного решения нет, но это скорее вопрос к студентам. В остальном всё здорово.
Спасательный островок
Если уже не успеваешь разобраться или застрял на каком-то задание поможет тебе быстро и недорого решить твою проблему.
Всё и так отлично
Всё очень удобно. Особенно круто, что есть система бонусов и можно выводить остатки денег. Очень много качественных бесплатных файлов.
Отзыв о системе "Студизба"
Отличная платформа для распространения работ, востребованных студентами. Хорошо налаженная и качественная работа сайта, огромная база заданий и аудитория.
Отличный помощник
Отличный сайт с кучей полезных файлов, позволяющий найти много методичек / учебников / отзывов о вузах и преподователях.
Отлично помогает студентам в любой момент для решения трудных и незамедлительных задач
Хотелось бы больше конкретной информации о преподавателях. А так в принципе хороший сайт, всегда им пользуюсь и ни разу не было желания прекратить. Хороший сайт для помощи студентам, удобный и приятный интерфейс. Из недостатков можно выделить только отсутствия небольшого количества файлов.
Спасибо за шикарный сайт
Великолепный сайт на котором студент за не большие деньги может найти помощь с дз, проектами курсовыми, лабораторными, а также узнать отзывы на преподавателей и бесплатно скачать пособия.
Популярные преподаватели
Добавляйте материалы
и зарабатывайте!
Продажи идут автоматически
6455
Авторов
на СтудИзбе
305
Средний доход
с одного платного файла
Обучение Подробнее