利用者:Jwilkins/VFX/Aspects/Pixels

提供: wiki
< 利用者:Jwilkins‎ | VFX‎ | Aspects
2013年9月24日 (火) 08:42時点におけるwiki>Jwilkinsによる版 (Created page with "= The Pixels Aspect = Header File: <tt>GPU_pixels.h</tt> This aspect is meant to replace <tt>Bitmap</tt> and <tt>DrawPixels</tt>. However, it is different enough from ''OpenGL'...")
(差分) ← 古い版 | 最新版 (差分) | 新しい版 → (差分)
移動先: 案内検索

The Pixels Aspect

Header File: GPU_pixels.h

This aspect is meant to replace Bitmap and DrawPixels. However, it is different enough from OpenGL that all of the module's symbols have been prefixed with GPU_.

Switching

void GPU_pixels_begin(void);
void GPU_pixels_end  (void);

Instead of using the GPU_aspect_begin function to switch into the Pixel aspect, this call has been wrapped with GPU_pixels_begin. Similarly with GPU_pixels_end. These functions take care of ending the previous aspect (assumed to be Basic) and starting the Font aspect.

Unlike the other aspects these begin/end wrapper functions are somewhat smart about default state and will automatically return OpenGL to its default PixelStore state when GPU_pixels_end is called.

Pixels

typedef struct GPUbitmap {
	GLsizei        width, height;
	GLsizei        xorig, yorig;
	const GLubyte* bitmap;
} GPUbitmap;

typedef struct GPUpixels {
	GLsizei       width, height;
	GLenum        format;
	GLenum        type;
	const GLvoid* pixels;
} GPUpixels;
void GPU_bitmap(GPUbitmap* bitmap);
void GPU_pixels(GPUpixels* pixels);

Position

void GPU_pixels_pos_2f(GLfloat x, GLfloat y);
void GPU_pixels_pos_3f(GLfloat x, GLfloat y, GLfloat z);

Format

void GPU_pixels_format(GLenum pname, GLint param);
GL_UNPACK_ROW_LENGTH
GL_UNPACK_SWAP_BYTES
GL_UNPACK_ALIGNMENT

The parameters passed to GPU_pixels_format control how data is read by GPU_pixels and GPU_pixels_cache.

Caching

Normally DrawPixels does not cache pixel data on the graphics card, leading to inefficiencies.

void GPU_bitmap_cache  (GPUbitmap* bitmap);
void GPU_pixels_cache  (GPUpixels* pixels);

void GPU_bitmap_uncache(GPUbitmap* bitmap);
void GPU_pixels_uncache(GPUpixels* pixels);

Zoom

void GPU_pixels_zoom(GLfloat xfactor, GLfloat yfactor);
void GPU_get_pixels_zoom(GLfloat* xfactor_out, GLfloat *yfactor_out);

The zoom factor passed into GPU_pixels_zoom has an effect similar to PixelZoom.

Other Parameters

void GPU_pixels_uniform_1f(GLenum pname, GLfloat param);
GL_RED_SCALE  
GL_RED_BIAS   
GL_GREEN_SCALE
GL_GREEN_BIAS 
GL_BLUE_SCALE 
GL_BLUE_BIAS  
GL_ALPHA_SCALE
GL_ALPHA_BIAS

The parameters passed to GPU_pixels_uniform_1f modify the color of the pixels drawn to the screen.