PDA

View Full Version : How to create a 2D multisample texure?



Ehsan Kamrani
06-17-2011, 08:53 PM
I try to set the target of glTexImage2D to GL_TEXTURE_2D_MULTISAMPLE. But I just see a white texture!
Here's my code:

glGenTextures(1, &m_texture2 );
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, m_texture2 );
glTexParameteri(GL_TEXTURE_2D_MULTISAMPLE,GL_TEXTU RE_MIN_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D_MULTISAMPLE,GL_TEXTU RE_MAG_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexImage2D(GL_TEXTURE_2D_MULTISAMPLE, 0, channels, size, size, 0, type, GL_UNSIGNED_BYTE, NULL );


So what's wrong?

Alfonse Reinheart
06-17-2011, 10:04 PM
You can't use glTexImage2D to create a multisample texture. You must use glTexImage2DMultisample (http://www.opengl.org/sdk/docs/man3/xhtml/glTexImage2DMultisample.xml).