#include "renderer_polygon_3d.hpp" #include #include "polygon_model.hpp" namespace endofthejedi { void RendererPolygon3d::setup() { std::cout<<"setup 3d" << std::endl; m_atomicBomb = new PolygonModel("../data/mesh/small_atomic_bomb.stl"); //m_atomicBomb = new PolygonModel("../data/mesh/quad_screen_coords.stl"); m_atomicBomb->import(); m_atomicBomb->uploadToOpenGl(); m_models.push_back(m_atomicBomb); std::string vss = "varying vec3 vertex;\n" "void main()\n" "{\n" " gl_Position = gl_Vertex;\n" " vertex = gl_Vertex.xyz;\n" "}\n" ; std::string fss = "varying vec3 vertex;\n" "void main()\n" "{\n" //" gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);\n" " gl_FragColor = vec4(0.5+0.5*vertex.xyz, 1.0);\n" "}\n" ; m_shader.init(); m_shader.load(vss.c_str(), GL_VERTEX_SHADER); m_shader.load(fss.c_str(), GL_FRAGMENT_SHADER); } void RendererPolygon3d::render(const game::State *state) { m_shader.bind(); (void) state; m_atomicBomb->bind(); m_atomicBomb->render(); //glColor3f(1.0, 0.0, 0.0); //glBegin(GL_QUADS); //glVertex2f(-1.0f, -1.0f); //glVertex2f(1.0f, -1.0f); //glVertex2f(1.0f, 1.0f); //glVertex2f(-1.0f, 1.0f); //glEnd(); //std::cout<<"render 3d" << std::endl; } }