THIS IS THE CODE:
PLEASE DISREGARD THE THIN BLACK LINES WHICH ARE SEEN ON THE IMAGE. THEY ARE THE PART OF THE CODE. I AM CONCERNED ABOUT THE BLACK PATCH WHICH IS COMING UP INSTEAD OF THE TEXT.
can you please let me know what I am doing wrong? This is really urgent.
Thanks in advance.
public void init(GLAutoDrawable drawable)
{
GL gl = drawable.getGL();
glut = new GLUT();
gl.glClearColor(0.8f, 0.7f, 0.5f, 0.0f);
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT );
gl.glShadeModel(GL.GL_SMOOTH);
gl.glEnable(GL.GL_TEXTURE_2D);
texture = genTexture(gl);
gl.glCopyTexImage2D(GL.GL_TEXTURE_2D, 0 , GL.GL_RGB, -1, 0, 128, 128, 0);
gl.glClear(GL.GL_COLOR_BUFFER_BIT);
gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR);
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR);
}
public void display(GLAutoDrawable drawable)
{
GL gl = drawable.getGL();
GLU glu = new GLU();
GLUT glut = new GLUT();
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
// Reset The Current Modelview Matrix
gl.glEnable(GL.GL_CULL_FACE);
gl.glLoadIdentity();
gl.glTranslatef(3.0f, 0.0f, -15.0f);
gl.glRotatef(rotqube/5,0.0f,1.0f,0.0f); // Rotate The cube around the Y axis
WriteText(drawable);
gl.glBegin(GL.GL_QUADS); // Draw The Cube Using quads
Drawcube(drawable);
gl.glEnd(); // End Drawing The Cube
DrawDivideLines(drawable);
rotqube ++;
if (rotqube/50 >= 360.f)
rotqube = 0.0f;
}
public void WriteText(GLAutoDrawable drawable){
GL gl = drawable.getGL();
GLUT glut = new GLUT();
gl.glPushMatrix();
gl.glLoadIdentity();
gl.glRasterPos3f(0, 0, 0);
glut.glutBitmapString(GLUT.BITMAP_TIMES_ROMAN_10, "write text here");
gl.glCopyTexSubImage2D(GL.GL_TEXTURE_2D, 0, 0, 0, 80, -40, 128,60);
gl.glClear(GL.GL_COLOR_BUFFER_BIT);
gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
gl.glPopMatrix();
}