Creating the rotation for an analogue timer in openGL -


I'm writing an OpenGL AS (2.0) game on Android.

I have a quad with text like:

Enter the image details here

Before I enter, at each level, I set a value that takes seconds to rotate the number of numbers. I just work how many degrees rotate each second, do the same:

  anglotote = 360 / number offsite;  

So when I rotate, I will do something like this: (pseudo code)

  if (countOneSecond ()) {rotateTimer (AngleToRotate)}  

So .... if I want to take it 60 seconds, I say

  anglototate = 360/60 (angle nutroot = 6)  

Every second, it rotates by 6 degrees, so, it completes a complete rotation in 1 minute.

Problem

The problem is that if I want to wander with an amount where the angle is not in absolute numbers then I have problems, so Say 80 seconds:

  AngleToRotate = 360/80 (anglottoret = 6) = 4.5  

So it only rotates with 4.

Summary

So, is it possible to rotate a tractor through a fraction of an angle? Or is there another move to complete the full revolution in any specific time period?

Code

Here's my rotation method:

  Public spacing (float x, float, float angle) ) {// Convert the OpenGL coordinates in the screen coordinates // X Plotrite and X Plot Lets are defined, I have removed them from here because they are not relevant to // this question / center's quad (X With) centreX = xPlotLeft + ((xPlotRight-xPlotLeft) / 2); // Center of Quad (Elang the Y) Sentry Y = yPlotBottom + ((yPlotTop-yPlotBottom) / 2); // Quad matrix. Rotate the sitemnt M (MRTation matrix, 0); Matrix Transselam M (matration matrix, 0, centrex, centri, 0f); Matrix.rotatem (mRotationMatrix, 0, -angle, 0, 0, 0.1f); Matrix Translam M (mRotationMatrix, 0, -centreX, -centreY, 0f); } OpenGL ES 2.0 is not really a concept of angles. We do not see it in the code you posted, but creates a rotation matrix from an angle, which ends up in the  mRotationMatrix  variable depending on the code that you show. There will be float elements in almost any change matrix you use, and therefore floating point can represent rotation for arbitrary angles within precision. 

If AngleToRotate is currently int , you will need to make it a float Similarly, if the rotates Time has a int argument, then change the type of argument to float then check the rotateTimer code, and make sure that It passes as float in the form of ambes, if it calls additional ways, at some point you should come to the code that creates rotation matrix, which From angle to angle, it will convert from angle to radius, calculate cos and sin angle, and populate the rotation matrix with those values.

I would recommend keeping all your angles in radians, but this is a style suggestion more.


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -