Tag Info

Hot answers tagged

4

Solution 1: Rotate your UVs in your vertex shader The vertex shader is where per-vertex attributes can be modified before rendering. These values are then linearly interpolated to generate values for all fragments of your polygons. As a rotation of your your UVs is a linear transformation, you only need to recalculate the values in the vertices, and linear ...


4

If the textures are the same general "shape" (dimensions, mip levels, etc.) then use texture arrays. You can pack differently "shaped" textures into different arrays if you have any regularity, which you should. This approach gives you all the advantages of individual textures (e.g., no bleeding) plus all the advantages of a texture atlas (e.g. fewer state ...


1

You have a very strange code here. Why do you have glDetachShader(program, vertex_shader); glDetachShader(program, fragment_shader); lines in your shader init code? They should be used when you destroy your shaders. Remove them completely or call them on quit. If it won't help, then I suspect that glDisableVertexAttribArray() resets vertex attribs' ...


1

Your problem is that you're doing this: glPushMatrix(); glTranslatef(0, 0.03 * dt, 0); // (...) glPopMatrix(); The offset created by the glTranslatef() command only exists between the glPushMatrix and the glPopMatrix; it doesn't retain its values from previous frames; the offset goes away forever as soon as the matrix is popped. So assuming that dt ...


1

There's an easy solution - don't translate with a matrix. Since you're using immediate mode, it's an incredibly easy matter to simply offset the texture coords however much you'd like. EG, glTexCoord2f(1, 0.03 * dt); This will, of course, not be so easily done when you learn about the OpenGL Core Profile, which is highly recommended to be used. But until ...


1

Try making your texture 512x512 that could be the issue since your texture is 400x400. XNA error logs state that the texture should be resized to a power of two.



Only top voted, non community-wiki answers of a minimum length are eligible