Results 1 to 2 of 2

Thread: About text and texture -- URGENT !!!

  1. #1
    Junior Member Newbie
    Join Date
    Mar 2009
    Posts
    14

    About text and texture -- URGENT !!!

    I am able to print text on the cube using texture and successfully rotate the cube so that text rotates with it.

    But my problem is this works only in init(). wht modifications shld i be doing to include this in the display functions so that i can make it dynamic.

    plz reply as i need this urgently....

    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);


    gl.glEnable(GL.GL_PIXEL_UNPACK_BUFFER);
    gl.glEnable(GL.GL_PIXEL_PACK_BUFFER);


    gl.glBindTexture(GL.GL_TEXTURE_2D, texture);

    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.glClearColor(0.8f, 0.7f, 0.5f, 0.0f);
    glut.glutBitmapString(GLUT.BITMAP_TIMES_ROMAN_10, "FINALLY!!!!!");
    gl.glCopyTexSubImage2D(GL.GL_TEXTURE_2D, 0, 0, 0, -20, -100, 128,115);
    gl.glClear(GL.GL_COLOR_BUFFER_BIT);
    gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);


    gl.glClearColor(0.8f, 0.7f, 0.5f, 0.0f);
    glut.glutBitmapString(GLUT.BITMAP_TIMES_ROMAN_10, "THIS TEXT");
    gl.glCopyTexSubImage2D(GL.GL_TEXTURE_2D, 0, 0, 0, 40, -60, 128,70);
    gl.glClear(GL.GL_COLOR_BUFFER_BIT);
    gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);

    gl.glClearColor(0.8f, 0.7f, 0.5f, 0.0f);
    glut.glutBitmapString(GLUT.BITMAP_TIMES_ROMAN_10, "IS WRITING");
    gl.glCopyTexSubImage2D(GL.GL_TEXTURE_2D, 0, 0, 0, 80, -20, 128,30);
    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);


    }

  2. #2
    Senior Member Regular Contributor remdul's Avatar
    Join Date
    Mar 2004
    Location
    The Netherlands
    Posts
    346

    Re: About text and texture -- URGENT !!!


Similar Threads

  1. Replies: 4
    Last Post: 08-22-2013, 01:47 PM
  2. ***URGENT***LOADING TEXTURE
    By kingabhi in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 05-10-2009, 02:21 PM
  3. URGENT!!!!! OPENGL TEXTURE HELP!!!!!!!!
    By negroidlatte in forum OpenGL: GLSL
    Replies: 3
    Last Post: 02-04-2006, 02:04 AM
  4. Replies: 1
    Last Post: 01-31-2005, 11:01 AM
  5. URGENT !!! Text in OpenGL window (Nehe)
    By nix in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 05-14-2001, 08:14 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean