bool GLES2Lesson::init(float w, float h, const std::string &vertexShader,
                           const std::string &fragmentShader) {

        printVerboseDriverInformation();

        gProgram = createProgram(vertexShader.c_str(), fragmentShader.c_str());

        if (!gProgram) {
            LOGE("Could not create program.");
            return false;
        }

        fetchShaderLocations();

        glViewport(0, 0, w, h);
        checkGlError("glViewport");

        projectionMatrix = glm::perspective(45.0f, w / h, 0.1f, 100.0f);

        camera = glm::vec3(0.0f, 0.25f, 0.0f);

        glFrontFace(GL_CW);
        glDepthMask(true);
        glEnable(GL_DEPTH_TEST);
        glDepthFunc(GL_LEQUAL);

        angleXzInDegress = 0.0f;
        updateDirectionVector();
        return true;
    }
示例#2
0
void Camera::lookDown(float amount)
{
	m_pitch -= amount;
	if(m_pitch < -90)
		m_pitch = -90;
	if(m_pitch > 90)
		m_pitch = 90;

	updateDirectionVector();
}
示例#3
0
void Camera::set(VECTOR3D newPosition, float newAngleYaw, float newAnglePitch)
{
	m_position.x = newPosition.x;
	m_position.y = newPosition.y;

	m_position.z = newPosition.z;
	m_yaw = newAngleYaw;
	m_pitch = newAnglePitch;

	updateDirectionVector();
}
示例#4
0
void Camera::turnRight(float amount)
{
	m_yaw += amount;

	updateDirectionVector();
}
示例#5
0
void Camera::turnLeft(float amount)
{
	m_yaw -= amount;

	updateDirectionVector();
}
 void GLES2Lesson::turnLeft(float factor) {
     angleXzInDegress += factor;
     updateDirectionVector();
 }