Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // OpenGL1_1_glut_init.cpp : Defines the entry point for the console application.
- //
- #include "GLee.h"
- #include <GL/glut.h>
- #include <SOIL.h>
- #include "Vertices.h"
- void render();
- GLuint tex = 0;
- int main(int argc, char* argv[])
- {
- glutInit(&argc, argv);
- glutInitWindowPosition(0, 0);
- glutInitWindowSize(800, 600);
- glutInitDisplayMode(GLUT_RGBA | GLUT_SINGLE | GLUT_DEPTH);
- glutCreateWindow("OGL application");
- glutDisplayFunc(render);
- tex = SOIL_load_OGL_texture("tex1.png", 4, 0, SOIL_FLAG_POWER_OF_TWO | SOIL_FLAG_MIPMAPS);
- glBindTexture(GL_TEXTURE_2D, tex);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
- //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_MIRRORED_REPEAT);
- glutMainLoop();
- return 0;
- }
- void render()
- {
- glClearColor(0, 0, 0, 1);
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- glDisable(GL_CULL_FACE);
- glFrontFace(GL_CCW);
- glCullFace(GL_BACK);
- glColor4f(1, 1, 1, 1);
- glBindTexture(GL_TEXTURE_2D, tex);
- glEnable(GL_TEXTURE_2D);
- glEnableClientState(GL_VERTEX_ARRAY);
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- glVertexPointer(3, GL_FLOAT, 0, vertices);
- glTexCoordPointer(2, GL_FLOAT, 0, uvs);
- glDrawArrays(GL_TRIANGLES, 0, 6);
- glDisableClientState(GL_TEXTURE_COORD_ARRAY);
- glDisableClientState(GL_VERTEX_ARRAY);
- glFlush(); // potrzebne w GLUT
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement