Results 1 to 2 of 2

Thread: update texture problem

  1. #1
    Junior Member Newbie
    Join Date
    Jun 2008
    Posts
    8

    update texture problem

    Hi, I am new to OpenGL. I am working on opengl with qt. what I need to do is to display one image. But this image is changing according my application. When I modify the "currentPixmap" out side paintGL(), it looks like my display texture is not updated, until I do window resize whatever to repaint. Here is my code:
    void GLWidget:aintGL()
    {
    glClear(GL_COLOR_BUFFER_BIT| GL_DEPTH_BUFFER_BIT);

    glBindTexture( GL_TEXTURE_2D, fbObject->bindTexture(currentPixmap));

    int i=currentPixmap.width(), j = currentPixmap.height();

    GLfloat w = i;
    GLfloat h = j;

    glEnable(GL_TEXTURE_2D);
    glPushMatrix();
    glColor3f(1.0, 1.0, 1.0);

    glBegin(GL_QUADS);
    glTexCoord2f(0.0, 0.0);
    glVertex3f(0, 0, -5.0);
    glTexCoord2f(1.0, 0.0);
    glVertex3f(w, 0, -5.0);
    glTexCoord2f(1, 1);
    glVertex3f(w, h, -5.0);
    glTexCoord2f(0.0, 1);
    glVertex3f(0, h, -5.0);
    glEnd();

    glPopMatrix();

    glFlush();
    }

    what can I do to force it to update the texture?

  2. #2
    Senior Member Frequent Contributor
    Join Date
    Apr 2000
    Location
    Melbourne,Victoria,Australia
    Posts
    748

    Re: update texture problem

    Do you actually load the contents of the modified texture into the texture object? Using glTexSubImage2D() for example? The code example you've provided will only USE the image. There's nothing there to actually update it.

Similar Threads

  1. Problem with drawing update.
    By robgeek in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 01-26-2013, 11:42 PM
  2. Color update problem
    By Arifin in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 07-22-2008, 03:23 AM
  3. Color update problem
    By Arifin in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 07-21-2008, 04:38 PM
  4. FF vs. shader texture update problem
    By hifuGL in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 09-07-2006, 07:12 AM
  5. Texture Update
    By in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 06-11-2002, 11:52 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