X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=demos%2Fcubemap.cpp;h=2a0bc02c6d1ffe83313837e7ff1778c78a160854;hp=512f519f260d619450dd9f60f938ec1f2db0dffa;hb=HEAD;hpb=9034e81679eeeaa3d1d5d643d3f924d9edb45a68 diff --git a/demos/cubemap.cpp b/demos/cubemap.cpp deleted file mode 100644 index 512f519f..00000000 --- a/demos/cubemap.cpp +++ /dev/null @@ -1,138 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace Msp; - -void create_face_texture(GL::TextureCube &texture, GL::TextureCubeFace face) -{ - unsigned char *pixels = new unsigned char[128*128*3]; - for(int y=0; y<128; ++y) - for(int x=0; x<128; ++x) - { - unsigned i = (x+y*128)*3; - GL::Vector3 v = texture.get_texel_direction(face, x, y); - if(v.y>0) - { - pixels[i] = 96-48*v.y; - pixels[i+1] = 168-84*v.y; - pixels[i+2] = 255; - } - else - { - pixels[i] = rand()%32; - pixels[i+1] = 128-rand()%32; - pixels[i+2] = rand()%32; - } - } - texture.image(face, 0, GL::RGB, GL::UNSIGNED_BYTE, pixels); - delete[] pixels; -} - -int main() -{ - Graphics::SimpleGLWindow window(600, 400); - - GL::TextureCube texture; - texture.storage(GL::RGB, 128); - texture.set_min_filter(GL::LINEAR); - texture.set_wrap(GL::CLAMP_TO_EDGE); - for(unsigned i=0; i<6; ++i) - create_face_texture(texture, texture.enumerate_faces(i)); - - GL::Mesh skybox((GL::VERTEX3, GL::TEXCOORD3)); - GL::BoxBuilder(10, 10, 10).build(skybox); - for(unsigned i=0; i