![]() ![]() Should I be passing the texture coordinates into the shader using a uniform variable? Is the problem that the shader overrides the texcoordspointer function? The texture is definitely being sampled correctly, because I can manually specify an arbitrary vec2 value for the texcoord and paint the entire object a colour from one part of my texture. However, in debugging it appears that using texture2D(tex, tex_coord) or texture2D(tex, gl_TexCoord.st) in gl_FragColor will always paint my object black. Gl_FragColor = gl_Color * texture2D(tex, tex_coord) ![]() GlBindBuffer(GL_ELEMENT_ARRAY_BUFFER, element_buffer) Īnd then in the vertex shader something like varying vec2 tex_coord GlTe圎nvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE) //not sure about this lineĪnd in my draw function: glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer) GlEnableClientState(GL_TEXTURE_COORD_ARRAY) where tcp is a pointer to an array of GLfloats containing my texcoords I thought I should be able to do something like this: glTexCoordPointer(2, GL_FLOAT, 0, tcp) I have excluded what I believe to be irrelevant code in the interests of brevity. Can I use glTexCoordPointer to specify texture coordinates for my shaders, or do I need to pass them in some other way? My program works fine aside from applying the texture. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |