Strange GE problem...

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
dridri
Posts: 34
Joined: Fri Jul 31, 2009 1:47 am

Strange GE problem...

Post by dridri »

I'm making a library wich has the goal to replace the PSPgu, it contains high and low level functions (actualy i can go to 650FPS when blitting a fullscreen image in 32bits mode).

Now I want to add functions to blit the Sony OSK but there was a bug when I blit image+osk (fast scanlines and controls doesn't respond, but no freeze).

I foudn a solution, but I've a question:
what is the difference between these two codes :

Code: Select all

	int j = 0;
	while &#40;j < width&#41; &#123;
		TextureVertex* vertices = &#40;TextureVertex*&#41;geGetMemory&#40;2 * sizeof&#40;TextureVertex&#41;&#41;;
		int sliceWidth = 64;
		if &#40;j + sliceWidth > width&#41; sliceWidth = width - j;
		vertices&#91;0&#93;.u = sx + j;
		vertices&#91;0&#93;.v = sy;
		vertices&#91;0&#93;.x = x + j;
		vertices&#91;0&#93;.y = y;
		vertices&#91;1&#93;.u = sx + j + sliceWidth;
		vertices&#91;1&#93;.v = sy + height;
		vertices&#91;1&#93;.x = x + j + sliceWidth;
		vertices&#91;1&#93;.y = y + height;
		vertices&#91;0&#93;.color = vertices&#91;1&#93;.color = 0xffffffff;

		geSendCommandi&#40;CMD_DRAW_MODE, GE_COLOR_8888 | GE_TEXTURE_16BIT | GE_VERTEX_16BIT | GE_TRANSFORM_2D&#41;;
		geSendCommandi&#40;CMD_VERTICES_POINTER, &#40;&#40;unsigned int&#41;vertices&#41; & 0xffffff&#41;;
		geSendCommandi&#40;CMD_DRAW_TYPE_VCOUNT, &#40;GE_SPRITES << 16&#41;|2&#41;;
		j += sliceWidth;
	&#125;

Code: Select all

	int total_count = &#40;&#40;int&#41;&#40;width/64&#41;&#41;+1;
	TextureVertex* vertices = &#40;TextureVertex*&#41;geGetMemory&#40;&#40;total_count<<1&#41; * sizeof&#40;TextureVertex&#41;&#41;;
	int count = 0;
	int j = 0;
	while&#40;j < width&#41;&#123;
		int sliceWidth = 64;
		if &#40;j + sliceWidth > width&#41; sliceWidth = width - j;
		vertices&#91;count+0&#93;.u = sx + j;
		vertices&#91;count+0&#93;.v = sy;
		vertices&#91;count+0&#93;.x = x + j;
		vertices&#91;count+0&#93;.y = y;
		vertices&#91;count+1&#93;.u = sx + j + sliceWidth;
		vertices&#91;count+1&#93;.v = sy + height;
		vertices&#91;count+1&#93;.x = x + j + sliceWidth;
		vertices&#91;count+1&#93;.y = y + height;
		vertices&#91;count+0&#93;.color = vertices&#91;count+1&#93;.color = 0xffffffff;
		j += sliceWidth;
		count += 2;
	&#125;

	geSendCommandi&#40;CMD_DRAW_MODE, GE_COLOR_8888 | GE_TEXTURE_16BIT | GE_VERTEX_16BIT | GE_TRANSFORM_2D&#41;;
	geSendCommandi&#40;CMD_VERTICES_POINTER, &#40;&#40;unsigned int&#41;vertices&#41; & 0xffffff&#41;;
	geSendCommandi&#40;CMD_DRAW_TYPE_VCOUNT, &#40;GE_SPRITES << 16&#41;|&#40;total_count<<1&#41;&#41;;
In the first, each "sprite" is blitted in the loop, in the second all vertices are stored and they're blitted when loop is finished.
I verified if the 'total_count' variable is the good, and yes...
I'm French, and 15 years old, so my English is not good...
Post Reply