Imagination PowerVR SDK Blog

How to rotate text on the screen ?


#1
Hi,

 

Does anyone know how to ratate text on the screen?

So far, I can use the following API to show text on the screen base on PVRtool.
m_Print3D.Print3D(8.0f, 30.0f, 1.5f, 0xFFAA4040, "example")

 

But, I want to rotate the text with 30 degree for x-axis(y-axis or z-axis ) on the screen.

Does anyone have any idea about this question?

 

Thank for your help.

#2
Hi,

By the way.

I implement this function which was shown text on the screen base on OpenGL ES 2.0 and I run this program in linux system.

 

So far,I only can show text on the screen.I can't rotate any degree of text with x-axis on the screen.

 

Does anyone have similar experience about this question?

If you have similar experience ,please kindly give me some suggestion.

 

 

Thanks.

#3

Print3D doesn’t offer this facility, I’m afraid. You could try altering the Print3D code to render at the angle you want, otherwise you’d have to implement your own solution.


#4

Hi Gordon,

    Thank for your response so quickly.

Could I ask more detail information about this question ?

 

In fact, I have tried to modify Print3D code.

in the PVRTPrint3DAPI.cpp

I find that there are two function which is relative with text.

 

The first one is APIDrawLogo.it will show the logo picture.

The second one is APIRenderStates.it seems like to show text on the screen.

 

in the APIDrawLogo()

I can rotate  logo picture by calling PVRTMatrixRotationZ().It can work successfully.

 

in the APIRenderStates()

I try to rotate text by calling  PVRTMatrixRotationZ().

but It cannot work successfully.

 

I can't rotate any angle by calling  PVRTMatrixRotationZ

Once I modify the Matrix, the text will disappear on the screen.

 

Do you have any idea about this question ?

I'm very appreciate your response again.

 

 

in the PVRTPrint3DAPI.cpp

 

  /* Set matrix with viewport dimensions */
  for(i=0; i<16; i++)
  {
   Matrix.f=0;
  }
  Matrix.f[0] = (2.0f/(m_fScreenScale[0]*640.0f));
  Matrix.f[5] = (-2.0f/(m_fScreenScale[1]*480.0f));
  Matrix.f[10] = (1.0f);
  Matrix.f[12] = (-1.0f);
  Matrix.f[13] = (1.0f);
  Matrix.f[15] = (1.0f);

 

  /* Use the shader */
  glUseProgram(m_pAPI->m_ProgramObject);

  /* Bind the projection and modelview matrices to the shader */
  int location = glGetUniformLocation(m_pAPI->m_ProgramObject, "myMVPMatrix");
  glUniformMatrix4fv( location, 1, GL_FALSE, Matrix.f);

 

#5

Hi Gordon,

    I have solved this issue.

it seems that the text is out of screen.

Therefore I can't see the text which I rotate.

 

Now I can rotate text successfully.

 

 

 

Thank for your help and response.

 

 

#6

That’s what I suspected was wrong when I read your last post - glad it’s working now :slight_smile: