Click here to Skip to main content
15,894,291 members

Comments by monerajesh (Top 2 by date)

monerajesh 15-Jul-12 16:39pm View    
this is how I implemented your code..but the result is a light green colored screen with no circle
int M_IN_DEGREE = 370;
int N_IN_DEGREE = 100;
int nCount = 1;
float[] stVertexArray=new float[2*360];
FloatBuffer sampleBuffer;

stVertexArray[0] = (float) 0.0;
stVertexArray[1] = (float) 0.0;

for( int nR =N_IN_DEGREE; nR < M_IN_DEGREE; nR++ )
{
float fX = (float) Math.sin((float)nR * (45*(Math.PI/180)) ) ;
float fY = (float)Math.cos((float)nR * (45*(Math.PI/180)) ) ;
stVertexArray[nCount*2] = fX;
stVertexArray[nCount*2 + 1] = fY;
nCount++;
}
ByteBuffer bBuff = ByteBuffer.allocateDirect(stVertexArray.length * 4);
bBuff.order(ByteOrder.nativeOrder());
sampleBuffer = bBuff.asFloatBuffer();
sampleBuffer.put(stVertexArray);
sampleBuffer.position(0);

gl.glEnableClientState( GL10.GL_VERTEX_ARRAY );
gl.glVertexPointer( 2, GL10.GL_FLOAT, 0, sampleBuffer );
gl.glDrawArrays( GL10.GL_LINE_LOOP, 0, nCount );
monerajesh 10-Jul-12 9:34am View    
hi, I cant use the glBegin and glEnd in my code..I draw to the surface view using gl.glDrawArrays and use gl. in every line to usea property in the onDrawFrame(GL10 gl) method..please guide me as to how to draw using the code you gave..I am a beginner in openGL..help is appreciated.