if you are using 1 texture unit (such as GL_TEXTURE0), then before you draw an object you need to bind the appropriate texture, so glBindTexture will go in the draw();
you don't need to call...
Type: Posts; User: Power2012
if you are using 1 texture unit (such as GL_TEXTURE0), then before you draw an object you need to bind the appropriate texture, so glBindTexture will go in the draw();
you don't need to call...
here is a tutorial about VAO which might help
http://programming4.us/multimedia/8300.aspx
this is part of my program, hopefully it helps
///////////////////////////////
// texture 1
const char *texName ="marble.jpg";
QImage timg =...
also could you remove these from the draw() function, and put them into init() function:
glUniform1i(textureUniform, 0);
glBindBuffer(GL_ARRAY_BUFFER, m_bufferIDs[i]);
//...
you have 2 objects, 2 VBOs, and 1 VAO. I'd suggest to create 2 VAOs rather than just 1
could you try to draw only the first object please, to do so just modify the for loop to for(unsigned int i=0; i<1; i++), see what if you get the texture right or not.
I did a test, which shows that you could just use one texture unit, such as GL_TEXTURE0.
and it seems quite a few things are not quite right in your source code.
As you are using 2 textures, it's better to use 2 texture units, i.e. GL_TEXTURE0, and GL_TEXTURE1.
another quick question, is texture atlas a standard practice for rendering textures to geometries? thanks
many thanks, that solved my problem.
Thanks for your reply. I think you are talking about cube map, but that is not what I want. I am thinking to do textures in more general way, for example, rather then a cube, we have a polygon with...
Hi there,
The question is very simple: I want to draw a cube with 6 different textures on 6 surfaces of the cube, what is the "proper" way to design the fragment shader?
My initial thought is...