Mazy
06-18-2005, 07:34 AM
For a texture you need to generate an id then bind that id in order to attach an image.
glGenTextures(1,t);
glBindTexture(GL_TEXTURE_2D,t);
glTexImage2D(GL_TEXTURE_2D,0,GL_RGB8,......);
for OpenglShadingLanguage you dont need this.
Handle = glCreateProgram();
ShaderHandle = glCreateShader(GL_VERTEX_SHADER_ARB);
glShaderSource(ShaderHandle,1,str,len);
glCompileShader(ShaderHandle);
glAttachShader(Handle,shaderHandle);
.. and so on.
Thats very nice since its not disturbing the stats in any way, so you dont need to store the current program and then return to that if you just need to prepare a program.
But then we have FBO that returns to the texture way.
glGenFramebuffersEXT(1,FrameBufferID);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, FrameBufferID);
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT,GL_CO lOR_ATTACHMENT_0_EXT,GL_TEXTURE_2D,textureID,0);
.......
and thus force a change in the states just to prepare the buffer.
Cant we stick to one of these sematics ?
glGenTextures(1,t);
glBindTexture(GL_TEXTURE_2D,t);
glTexImage2D(GL_TEXTURE_2D,0,GL_RGB8,......);
for OpenglShadingLanguage you dont need this.
Handle = glCreateProgram();
ShaderHandle = glCreateShader(GL_VERTEX_SHADER_ARB);
glShaderSource(ShaderHandle,1,str,len);
glCompileShader(ShaderHandle);
glAttachShader(Handle,shaderHandle);
.. and so on.
Thats very nice since its not disturbing the stats in any way, so you dont need to store the current program and then return to that if you just need to prepare a program.
But then we have FBO that returns to the texture way.
glGenFramebuffersEXT(1,FrameBufferID);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, FrameBufferID);
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT,GL_CO lOR_ATTACHMENT_0_EXT,GL_TEXTURE_2D,textureID,0);
.......
and thus force a change in the states just to prepare the buffer.
Cant we stick to one of these sematics ?