Skip to content

Instantly share code, notes, and snippets.

@d8ta
Created May 30, 2014 11:21
Show Gist options
  • Save d8ta/cf5c58388f9805b47aaa to your computer and use it in GitHub Desktop.
Save d8ta/cf5c58388f9805b47aaa to your computer and use it in GitHub Desktop.
#include <oogl/Texture2D.h>
#include <oogl/GLSLProgram.h>
oogl::GLSLProgram* phongshader;
oogl::Texture2D* skybox;
phongshader = oogl::GLSLProgram::create("/Users/danielraudschus/Documents/spacerace/projectSpacerace/spacerace/data/shader/textShader.vert", "/Users/danielraudschus/Documents/spacerace/projectSpacerace/spacerace/data/shader/textShader.frag");
skybox = oogl::Texture2D::load(oogl::Image::load("/Users/danielraudschus/Documents/spacerace/build/bin/Debug/data/textures/comic.jpg"));
beispiel für einbinden:
// Render the front quad
glPushMatrix();
{
phongshader->bind();
skybox->bind();
(*phongshader)["texture"].set(skybox);
glBegin(GL_QUADS);
glTexCoord2f(0, 0); glVertex3f( 0.5f, -0.5f, -0.5f );
glTexCoord2f(1, 0); glVertex3f( -0.5f, -0.5f, -0.5f );
glTexCoord2f(1, 1); glVertex3f( -0.5f, 0.5f, -0.5f );
glTexCoord2f(0, 1); glVertex3f( 0.5f, 0.5f, -0.5f );
glEnd();
}
glpopMatrix();
// und wieder unbind
//in der main dann am ende:
delete skybox;
delete phongshader;
skybox->unbind();
phongshader->unbind();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment