tailieunhanh - 3D Graphics with OpenGL ES and M3G- P32
3D Graphics with OpenGL ES and M3G- P32: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. | 294 BASIC M3G CONCEPTS CHAPTER 13 Performance tip On hardware-accelerated devices it is a good idea to clear the color buffer and depth buffer completely and in one go even if the whole screen will be redrawn. Various hardware optimizations can only be enabled when starting from a clean table and some devices can clear the screen by just flipping a bit. Even with software implementations clearing everything is typically faster than clearing a slightly smaller viewport. Note that the viewport need not lie inside the render target it can even be larger than the render target. The view that you render is automatically scaled to fit the viewport. For example if you have a viewport of 1024 by 1024 pixels on a QVGA screen you will only see about 7 of the rendered image the nonvisible parts are not really rendered of course so there is no performance penalty see the code example in Section . The maximum size allowed for the viewport does not depend on the type of rendering target but only on the implementation. All implementations are required to support viewports up to 256 by 256 pixels but in practice the upper bound is 1024 by 1024 or higher. The exact limit can be queried from . Pitfall Contrary to OpenGL ES there is no separate function for setting the scissor rectangle see Section . Instead the scissor rectangle is implicitly defined as the intersection of the viewport and the Graphics clipping rectangle. A concept closely related to the viewport is the depth range set by setDepthRange float near float ar where near and far are in the range 0 1 . Similar to the viewport the depth range also defines a mapping from normalized device coordinates to screen coordinates only this time the screen coordinates are depth values that lie in the 0 1 range. Section gives insight on the depth range and how it can be used to make better use of the depth buffer resolution or to speed up your application. RENDERING As we move toward more
đang nạp các trang xem trước