[OPENGL] Texture


#1

Hello !

I have a problem with opengl texture, i don’t use the juce class, i use my own renderer that work well without juce, i couldnt overstand with my texture doesnt show up … with gDebugger, i can see my texture well load but no display at all …

If someone now why opengl texture doesnt work … i don’t use the juce Image class, i have also my own because i know there is some problem with juce Image class and texture…

This is the way i proceed :

creation :

unsigned int	texture;
 
glGenTextures(1, &texture);
glBindTexture(GL_TEXTURE_2D, texture);
 
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
 
glTexImage2D(GL_TEXTURE_2D, 0, 4, len_x, len_y, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
glBindTexture(GL_TEXTURE_2D, 0);

update (OGLTexture class):

glBindTexture(GL_TEXTURE_2D, this->_id);
glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, x1, y1, GL_RGBA, GL_UNSIGNED_BYTE, this->_data->getData());
glBindTexture(GL_TEXTURE_2D, 0);

Display

glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, text->getOGLTexture());

Thanks for your help


#2

And what is the problem?