Texture Rendering not working.

Hello everyone,

I’m trying to do a basic texture mapping to some GL_QUAD_STRIP.

in setup:

  
   
    skin.loadImage("skin-1.png");  
    t.allocate(skin.getWidth(), skin.getHeight(), GL_RGBA32F_ARB, true);  
    t.loadData(skin.getPixels(), skin.getWidth(), skin.getHeight(), GL_RGBA32F_ARB);  
  

in draw():

  
  
    t.bind();  
    ofEnableAlphaBlending();  
    glBegin(GL_QUAD_STRIP);  
      glTexCoord2f(0.0f, 0.0f); glVertex2f(ofGetScreenWidth()/2 - bottom.width/2 , ofGetScreenHeight()/2 - bottom.height/2);	// Bottom Left Of The Texture and Quad  
      glTexCoord2f(0.0f, 1.0f); glVertex2f(ofGetScreenWidth()/2 - bottom.width/2 , ofGetScreenHeight()/2 - bottom.height/2 + 100);	// Bottom Right Of The Texture and Quad  
      glTexCoord2f(1.0f, 0.0f); glVertex2f(ofGetScreenWidth()/2 - bottom.width/2 + 100, ofGetScreenHeight()/2 - bottom.height/2);	// Top Right Of The Texture and Quad  
      glTexCoord2f(1.0f, 1.0f); glVertex2f(ofGetScreenWidth()/2 - bottom.width/2 + 100, ofGetScreenHeight()/2 - bottom.height/2 + 100);  
    glEnd();  
    glBegin(GL_QUADS);  
        glTexCoord2f(0.0f, 0.0f); glVertex2f(0.0f,0.0f);  
        glTexCoord2f(1.0f, 0.0f); glVertex2f(100.0f,0.0f);  
        glTexCoord2f(1.0f, 1.0f); glVertex2f(100.0f,100.0f);  
        glTexCoord2f(0.0f, 1.0f); glVertex2f(0.0f,100.0f);  
    glEnd();  
    t.unbind();  

nothing gets into the screen. If I disable the AlphaBlending and apply white color, I get the two boxes drawn in white. if I apply the texture, it turn black, and with alphablending nothing gets shown.

I will be using multiple quadstrips, but for testing purposes, I’m just drawing 1 QUAD on both tests.

any ideas?

thanks in advanced.

I am late with the answer but maybe somebody could find this useful.
Have you tried specifing the texCoords in image width and height, instead of 0.0 to 1.0?
For example if the image is 512 x 512 pixels, then the texture coordinates are:

  
  
  
int width = 512;  
int height = 512;  
  
    glBegin(GL_QUADS);    
        glTexCoord2f(0.0f, 0.0f); glVertex2f(0.0f,0.0f);    
        glTexCoord2f(width, 0.0f); glVertex2f(100.0f,0.0f);    
        glTexCoord2f(width, height); glVertex2f(100.0f,100.0f);    
        glTexCoord2f(0.0f, height); glVertex2f(0.0f,100.0f);    
    glEnd();    

Does Your .png image is a GL_RGBA32F_ARB type? Are yoiu using ofImage or ofFloatImage? because if it is a GL_RGBA32F_ARB i think you should use ofFloatImage. and then also ofTexture use GL_TEXTURE2D , so if you don’t use a texture of power2 you may encounter some issues.