Ejemplo n.º 1
0
VBO* TextureSticker::getTexCoordsVbo()
{
	// Check if TextureSticker's elements have been initialized before
	if (!sm_isInitialized)
	{
		initializeElements();
		sm_isInitialized = true;
//		return NULL;
	}
	
	return sm_quadTexCoordsVbo;
}
Ejemplo n.º 2
0
/**
 * Creates matrix of order m x n. If invalid order is passed creates a 0x0 matrix
 * throws: ALLOCATION_FAILURE
 */
matrix::matrix(int rhsRow, int rhsColumn) throw(int){

	//If valid order...
	if(isOrderValid(rhsRow, rhsColumn)){

		row = rhsRow;
		column = rhsColumn;

		makeMatrix();

		initializeElements();

	}

	else
		resetOrder();
}
Ejemplo n.º 3
0
void TextureSticker::fullScreenTextureDepth(CGoGNGLuint texId, CGoGNGLuint dtexId)
{
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	// Check if TextureSticker's elements have been initialized before
	if (!sm_isInitialized)
	{
		initializeElements();
		sm_isInitialized = true;
	}

	// Check if depth test is enabled

//	GLboolean wasDepthTestEnabled = glIsEnabled(GL_DEPTH_TEST);

	// Disable depth test if it was enabled
//	if (wasDepthTestEnabled == GL_TRUE)
//		glDisable(GL_DEPTH_TEST);

	// Bind texture mapping shader
	sm_depthtextureMappingShader->bind();

	// Set texture uniform
	sm_depthtextureMappingShader->setTextureUnit(GL_TEXTURE0);
	sm_depthtextureMappingShader->activeTexture(texId);
	sm_depthtextureMappingShader->setDepthTextureUnit(GL_TEXTURE1);
	sm_depthtextureMappingShader->activeDepthTexture(dtexId);


	// Set matrices uniforms
	glm::mat4 projMatrix = glm::ortho(-1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f);
	glm::mat4 viewMatrix(1.0f);
	sm_depthtextureMappingShader->updateMatrices(projMatrix, viewMatrix);

	// Draw quad
	sm_depthtextureMappingShader->enableVertexAttribs();
	glDrawArrays(GL_QUADS, 0, 4);
	sm_depthtextureMappingShader->disableVertexAttribs();

	// Unbind texture mapping shader
	sm_depthtextureMappingShader->unbind();

	// Re-enable depth test if it was enabled before
//	if (wasDepthTestEnabled == GL_TRUE)
//		glEnable(GL_DEPTH_TEST);
}
Ejemplo n.º 4
0
/**
 * Changes the order of the matrix. If order is invalid throws INVALID_ORDER exception
 * throws: ALLOCATION_FAILURE, INVALID_ORDER
 */
void matrix::order_ip(int rhsRow, int rhsColumn) throw(int){

	if(!isOrderValid(rhsRow, rhsColumn))
		throw INVALID_ORDER;

	//Clear previous order
	delete []p_mat;

	//Store new order
	row = rhsRow;
	column = rhsColumn;

	makeMatrix();

	//initialise all elements to 0
	initializeElements();

}
Ejemplo n.º 5
0
/**
 * Creates a copy of given matrix if its order is valid, else creates a 0x0 matrix
 * throws: ALLOCATION_FAILURE
 */
matrix::matrix(const matrix& rhs) throw(int){


	//If valid matrix...
	if(isOrderValid(rhs.row, rhs.column)){

		//store the required order
		row = rhs.row;
		column = rhs.column;

		//Create space for the matrix
		makeMatrix();

		//Copy the elements
		initializeElements(rhs);

	}

	else
		resetOrder();

}
Ejemplo n.º 6
0
TEST_F(ThermoPhase_Fixture, SetAndGetElementPotentials)
{
  initializeElements();

  // Check that getElementPotentials returns false if no element potentials have been set yet.
  vector_fp getLambda(3);
  EXPECT_FALSE(test_phase.getElementPotentials(&getLambda[0]));

  vector_fp tooSmall(2);
  EXPECT_THROW(test_phase.setElementPotentials(tooSmall), CanteraError);

  vector_fp setLambda(3);
  setLambda[0] = 1.;
  setLambda[1] = 2.;
  setLambda[2] = 3.;
  test_phase.setElementPotentials(setLambda);

  EXPECT_TRUE(test_phase.getElementPotentials(&getLambda[0]));
  EXPECT_DOUBLE_EQ(setLambda[0], getLambda[0]);
  EXPECT_DOUBLE_EQ(setLambda[1], getLambda[1]);
  EXPECT_DOUBLE_EQ(setLambda[2], getLambda[2]);
}
Ejemplo n.º 7
0
void TextureSticker::fullScreenShader(Utils::GLSLShader* shader)
{
	// Check if TextureSticker's elements have been initialized before
	if (!sm_isInitialized)
	{
		initializeElements();
		sm_isInitialized = true;
	}
	
	// Check if depth test is enabled
	GLboolean wasDepthTestEnabled = glIsEnabled(GL_DEPTH_TEST);
	
	// Disable depth test if it was enabled
	if (wasDepthTestEnabled == GL_TRUE)
		glDisable(GL_DEPTH_TEST);
	
	// Bind shader
	shader->bind();
	
	// Set matrices uniforms
	glm::mat4 projMatrix = glm::ortho(-1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f);
	glm::mat4 viewMatrix(1.0f);
	shader->updateMatrices(projMatrix, viewMatrix);

	// Draw quad
	shader->enableVertexAttribs();
	glDrawArrays(GL_QUADS, 0, 4);
	shader->disableVertexAttribs();
	
	// Unbind shader
	shader->unbind();

	// Re-enable depth test if it was enabled before
	if (wasDepthTestEnabled == GL_TRUE)
		glEnable(GL_DEPTH_TEST);
}
Ejemplo n.º 8
0
void SettingsWindow::setToDefault()
{
  GSettings::resetToDefault();
  initializeElements();
}
Ejemplo n.º 9
0
void SettingsWindow::showEvent(QShowEvent *event)
{
  initializeUI();
  initializeElements();
  event->accept();
}