GTE beginner questions

Graphic based area of development (Graphics Processing Unit), including the Geometry Transform Engine (GTE), TIM, STR (MDEC), etc.
Post Reply
User avatar
Jaberwocky
Active PSXDEV User
Active PSXDEV User
Posts: 35
Joined: Oct 31, 2019

GTE beginner questions

Post by Jaberwocky » May 27th, 2020, 5:52 am

Heyho :D

I started reading and playing around with the GTE - and as always I run into various problems. (I wonder why am I always the guy asking those things >o<)

My plan is to display a simple 2D rectangle with a texture, with all the GTE stuff happening but with a rotation and translation of 0 - also with no perspective. So Basicly I want to see my sprite.
The good thing is: I see my sprite ^o^ The bad thing... it is 2 times bigger then it should be and it refuses to shrink in size :/

My GTE setup code looks like that:

Code: Select all

VECTOR  transV{0, 0, 0};
SVECTOR rotV{0, 0, 0};

//We run in PAL mode
SetVideoMode(MODE_PAL);
SsSetTickMode(SS_TICK50);

/*
Setting up double buffer and such
*/

InitGeom();
SetGeomOffset(0, 0);
SetGeomScreen(512);

TransMatrix(&trans, &transV);
RotMatrix_gte(&rotV, &rot);


SetRotMatrix(&rot);
SetTransMatrix(&trans);

SetDispMask(0);
Before stuffing my "POLY_FT4" to the ordering table I do:

Code: Select all

SVECTOR inputCoordinates[] =
{
	this->position,
	{(this->position.vx + Flammie::Width),  this->position.vy,                    this->position.vz},
	{ this->position.vx,                   (this->position.vy + Flammie::Height), this->position.vz},
	{(this->position.vx + Flammie::Width), (this->position.vy + Flammie::Height), this->position.vz}
};

long p;
long flag;

RotAverage4(&inputCoordinates[0], &inputCoordinates[1], &inputCoordinates[2], &inputCoordinates[3],
		   (long*)&this->ouput.x0, (long*)&this->ouput.x1, (long*)&this->ouput.x2, (long*)&this->ouput.x3,
		    &p, &flag);
position is a SVECTOR set to {0, 0, 0} because I wanted the sprite to appear in the upper left corner. Which he does but 2 times his size.

I also tried applying a scaling vector in my setup phase - but no matter what I do it stays two times its size :/

Code: Select all

MATRIX  scaly;
VECTOR  scaleV{2048, 2048, 2048};

SetRotMatrix(&rot);
SetTransMatrix(&trans);
MulRotMatrix(&scaly);
Any ideas? >o<
Also... is there some explaining reading material to pick up on those subjects?

User avatar
Jaberwocky
Active PSXDEV User
Active PSXDEV User
Posts: 35
Joined: Oct 31, 2019

Post by Jaberwocky » May 28th, 2020, 5:48 am

I actually made progress on this! I figured out, that when the Z Axis of my sprite is 0, then the it will be twice the original size.
So I set the Z to 1 and set the SetGeomScreen to 1. Now it works! I think this is related to the perspective calculation (h/Sz)? Where h is the distance to the screen.

However if I set SetGeomScreen to 512 while having Z at 1 - then my sprite is again two times the size... Why? I don't get that relation....

Edit: I bound the Z-Axis to L1 and R1 to play around a bit with it. Now I can kiiiinda see/guess the perspective that is used. Still a bit confusing though...

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest