Beispiel #1
0
ShaderCustomTex::ShaderCustomTex() :
m_col(1.0f, 1.0f, 1.0f, 1.0f)
{
	m_nameVS = "ShaderCustomTex_vs";
	m_nameFS = "ShaderCustomTex_fs";
	m_nameGS = "ShaderCustomTex_gs";

	std::string glxvert(*GLSLShader::DEFINES_GL);
	glxvert.append(vertexShaderText);

	std::string glxgeom = GLSLShader::defines_Geom("triangles", "triangle_strip", 3);
	glxgeom.append(geometryShaderText);

	std::string glxfrag(*GLSLShader::DEFINES_GL);
	glxfrag.append(fragmentShaderText);

//	loadShadersFromMemory(glxvert.c_str(), glxfrag.c_str());
	loadShadersFromMemory(glxvert.c_str(), glxfrag.c_str(), glxgeom.c_str(), GL_TRIANGLES, GL_TRIANGLE_STRIP, 3);

	m_unif_unit = glGetUniformLocation(this->program_handler(), "textureUnit");

	setBaseColor(m_col);

	Geom::Matrix44f id;
	id.identity();
	setTransformation(id);

}
Beispiel #2
0
void MyQT::createMap()
{
//	Dart d1 = Algo::Modelisation::createTetrahedron<PFP>(myMap);

//	Dart d2 = d1;

	position = myMap.addAttribute<PFP::VEC3, VERTEX>("position");

	Algo::Modelisation::Polyhedron<PFP> prim1(myMap, position);
	prim1.cylinder_topo(256, 256, true, true); // topo of sphere is a closed cylinder
	prim1.embedSphere(2.0f);

//	Dart d2 = d1;
//	position[d2] = PFP::VEC3(1, 0, 0);
//	d2 = PHI1(d2);
//	position[d2] = PFP::VEC3(-1, 0, 0);
//	d2 = PHI1(d2);
//	position[d2] = PFP::VEC3(0, 2, 0);
//	d2 = PHI<211>(d2);
//	position[d2] = PFP::VEC3(0, 1, 2);

	Algo::Modelisation::Polyhedron<PFP> prim2(myMap, position);
	prim2.cylinder_topo(256, 256, true, true); // topo of sphere is a closed cylinder
	prim2.embedSphere(2.0f);

	Geom::Matrix44f trf;
	trf.identity();
	Geom::translate<float>(5.0f, 0.0, 0.0, trf);
	prim2.transform(trf);

	xd1 = prim2.getDart();

//	xd1 = Algo::Modelisation::Polyhedron<PFP>::createTetra(myMap);
//	Dart xd2 = xd1;
//
//	position[xd2] = PFP::VEC3(5, 0, 0);
//	xd2 = PHI1(xd2);
//	position[xd2] = PFP::VEC3(3, 0, 0);
//	xd2 = PHI1(xd2);
//	position[xd2] = PFP::VEC3(4, 2, 0);
//	xd2 = PHI<211>(xd2);
//	position[xd2] = PFP::VEC3(4, 1, 2);

    //  bounding box of scene
    Geom::BoundingBox<PFP::VEC3> bb = Algo::Geometry::computeBoundingBox<PFP>(myMap, position);
    float lWidthObj = std::max<PFP::REAL>(std::max<PFP::REAL>(bb.size(0), bb.size(1)), bb.size(2));
    Geom::Vec3f lPosObj = (bb.min() +  bb.max()) / PFP::REAL(2);

    // send BB info to interface for centering on GL screen
	setParamObject(lWidthObj, lPosObj.data());

	// first show for be sure that GL context is binded
	show();

	// render the topo of the map without boundary darts
	SelectorDartNoBoundary<PFP::MAP> nb(myMap);
	m_render_topo->updateData<PFP>(myMap, position, 0.9f, 0.9f,nb);
}
Beispiel #3
0
	void Uniform<geom::Matrix44f>::SetUnchecked(geom::Matrix44f const & value) const
	{
		ASSERT(IsInitialized());
#if defined(CRAG_GLES)
		GL_CALL(glUniformMatrix4fv(_location, 1, GL_FALSE, geom::Transposition(value).GetArray()));
#elif defined(CRAG_GL)
		GL_CALL(glUniformMatrix4fv(_location, 1, GL_TRUE, value.GetArray()));
#endif
	}