SubmitQuad render position error
by DieRich · in Torque 2D Beginner · 04/27/2014 (11:29 pm) · 4 replies
hi all, I create a class inherited from SceneObject, and in function sceneRender() I called SubmitQuad() as:
vertexPos0 = Vector2(0, mSize.y) + getPosition();
vertexPos1 = Vector2(mSize.x, mSize.y) + getPosition();
vertexPos2 = Vector2(mSize.x, 0) + getPosition();
vertexPos3 = Vector2(0, 0) + getPosition();
pBatchRenderer->SubmitQuad( vertexPos0, vertexPos1, vertexPos2, vertexPos3,
Vector2( 0, 1 ),
Vector2( 1, 1 ),
Vector2( 1, 0 ),
Vector2( 0, 0 ),
mTextureHandle );
but image render postion is error, and I tried getRenderPosition(), it returns (0, 0).
why is that? any clue is thankful.
thanks.
vertexPos0 = Vector2(0, mSize.y) + getPosition();
vertexPos1 = Vector2(mSize.x, mSize.y) + getPosition();
vertexPos2 = Vector2(mSize.x, 0) + getPosition();
vertexPos3 = Vector2(0, 0) + getPosition();
pBatchRenderer->SubmitQuad( vertexPos0, vertexPos1, vertexPos2, vertexPos3,
Vector2( 0, 1 ),
Vector2( 1, 1 ),
Vector2( 1, 0 ),
Vector2( 0, 0 ),
mTextureHandle );
but image render postion is error, and I tried getRenderPosition(), it returns (0, 0).
why is that? any clue is thankful.
thanks.
#2
04/28/2014 (4:40 am)
Are you setting the SceneObject position in script as well? What happens when you setPosition to multiple spots? Does the render position change?
#3

Box2D/Torque 2D uses meters as its unit of length so a sprite that is 6x6 is 6 meters wide in X and 6 meters high in Y. The camera view is typically set to something like 100x75 (100 meters wide by 75 meters high) which is a 4:3 aspect ratio to fit with a computer monitor resolution like 1024x768.
Local coordinates have 0,0 as the center of an object.
04/28/2014 (9:56 am)
The world coordinate system comes from the standards used by Box2D - which is your normal cartesian coordinates:
Box2D/Torque 2D uses meters as its unit of length so a sprite that is 6x6 is 6 meters wide in X and 6 meters high in Y. The camera view is typically set to something like 100x75 (100 meters wide by 75 meters high) which is a 4:3 aspect ratio to fit with a computer monitor resolution like 1024x768.
Local coordinates have 0,0 as the center of an object.
#4
04/28/2014 (11:39 pm)
thanks mike, I'm trying on it, if there is a sample will be very thankful, and I still don't know how to render a sceneobject in screen by pixel, and the angle in sceneobject is set.
Torque 3D Owner DieRich
thanks.