3D Graphics with OpenGL ES and M3G- P43

3D Graphics with OpenGL ES and M3G- P43:Mobile phones are the new vehicle for bringing interactive graphics technologies to consumers. Graphics that in the 1980s was only seen in industrial flight simulators and at the turn of the millennium in desktop PCs and game consoles is now in the hands of billions of people. This book is about the technology underpinnings of mobile threedimensional graphics, the newest and most rapidly advancing area of computer graphics. | 404 FIXED-POINT MATHEMATICS APPENDIX A In these examples we showed the programs as a list of assembly instructions. It is not possible to compile them into a working program without some modifications. Here is an example of an inlined assembly routine that you can actually call from your C program using an ARM GCC compiler INLINE int mul_fixed_fixed int a int b int result tmp __asm__ smull 0 1 2 3 n t mov 0 0 lsr 16 n t orr 0 0 1 lsl 16 n t r result r tmp r a r b return result Here the compiler allocates the registers and places the register of result to argument 0 tmp to 1 a to 2 and b to 3. For result and tmp means that the register is going to be written to and indicates that this register cannot be used for anything else inside thisasm_statement. The first line performs a signed multiply of a and b and stores the low 32 bits to result and the high 32 bits to tmp. The second line shifts the result right 16 times the third line shifts tmp left 16 times and combines tmp and result into result using a bitwise OR. The interested reader may want to consult a more in-depth exposition on GCC inline assembly S03 Bat . Another compiler that is used a lot for mobile development is the ARM RVCT compiler. It also handles the register allocation of the inline assembly. RVCT goes a step further though there is no need to specify registers and their constraints as they are automatically handled by the compiler. Here is the previous example code in the inline assembler format used by RVCT INLINE int mul_fixed_fixed int a int b int result tmp __asm smull result tmp a b mov result result Isr 16 orr result result tmp lsl 16 return result For a list of supported instructions check ARM Instruction Set Quick Reference Card Arm . SECTION FIXED-POINT METHODS IN JAVA 405 FIXED-POINT METHODS IN JAVA Fixed-point routines in Java work almost exactly as in C except that you do not have to struggle with the portability of 64-bit integers because the long type in Java is .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.