check_error();
glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
check_error();
- glTexImage1D(GL_TEXTURE_1D, 0, GL_LUMINANCE16F_ARB, 2, 0, GL_LUMINANCE, GL_FLOAT, texdata);
+ glTexImage1D(GL_TEXTURE_1D, 0, GL_R16F, 2, 0, GL_RED, GL_FLOAT, texdata);
check_error();
// Basic state.
// texture coordinates in order not to get long stretches of (1,1,1,...)
// at the start and (...,0,0,0) at the end.
float vertices[] = {
+ 0.0f, 1.0f,
0.0f, 0.0f,
- 1.0f, 0.0f,
1.0f, 1.0f,
- 0.0f, 1.0f
+ 1.0f, 0.0f
};
float texcoords[] = {
+ 0.25f, 0.0f,
0.25f, 0.0f,
0.75f, 0.0f,
- 0.75f, 0.0f,
- 0.25f, 0.0f
+ 0.75f, 0.0f
};
GLuint vao;
GLuint position_vbo = fill_vertex_attribute(glsl_program_num, "position", 2, GL_FLOAT, sizeof(vertices), vertices);
GLuint texcoord_vbo = fill_vertex_attribute(glsl_program_num, "texcoord", 2, GL_FLOAT, sizeof(texcoords), texcoords);
- glDrawArrays(GL_QUADS, 0, 4);
+ glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
check_error();
cleanup_vertex_attribute(glsl_program_num, "position", position_vbo);
check_error();
glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
check_error();
- glTexImage1D(GL_TEXTURE_1D, 0, GL_LUMINANCE32F_ARB, 512, 0, GL_LUMINANCE, GL_FLOAT, texdata);
+ glTexImage1D(GL_TEXTURE_1D, 0, GL_R32F, 512, 0, GL_RED, GL_FLOAT, texdata);
check_error();
// Basic state.
// Draw the texture stretched over a long quad, interpolating it out.
float vertices[] = {
+ 0.0f, 1.0f,
0.0f, 0.0f,
- 1.0f, 0.0f,
1.0f, 1.0f,
- 0.0f, 1.0f
+ 1.0f, 0.0f
};
float texcoords[] = {
+ 0.25f, 0.0f,
0.25f, 0.0f,
0.75f, 0.0f,
- 0.75f, 0.0f,
- 0.25f, 0.0f
+ 0.75f, 0.0f
};
GLuint vao;
GLuint position_vbo = fill_vertex_attribute(glsl_program_num, "position", 2, GL_FLOAT, sizeof(vertices), vertices);
GLuint texcoord_vbo = fill_vertex_attribute(glsl_program_num, "texcoord", 2, GL_FLOAT, sizeof(texcoords), texcoords);
- glDrawArrays(GL_QUADS, 0, 4);
+ glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
check_error();
cleanup_vertex_attribute(glsl_program_num, "position", position_vbo);