コード例 #1
0
bool SystemClass::SystemInitialization()
{
	CreateConsole();

	cout << ">>Information Window Initialized" << endl;

	if (!WindowInitialization())
	{
		return false;
	}

	cout << ">>Window Initialized" << endl;

	mInput = new InputClass;
	if (!mInput)
	{
		return false;
	}
	
	mInput->Initialize();

	cout << ">>>>Input Controls Active" << endl;

	cout << ">>>>Timer Initalized" << endl;

	mGraphics = new GraphicsClass;
	if (!mGraphics)
	{
		return false;
	}

	if (!mGraphics->Initialize(WINDOW_WIDTH, WINDOW_HEIGHT, mHandle))
	{
		return false;
	}

	cout << ">>Graphics Fully Initialized" << endl;


	return true;
}
コード例 #2
0
ファイル: Rcsgedit.cpp プロジェクト: GuMiner/Rcsg-editor
// Performs visual OpenGL setup,
bool Rcsgedit::ApplicationSetup()
{
    if (!WindowInitialization())
    {
        std::cout << "Failed to initialize the OpenGL window!" << std::endl;
        return false;
    }

    // Only works if faces are positioned appropriately, 
    glEnable(GL_CULL_FACE);
    glFrontFace(GL_CCW);

    glEnable(GL_DEPTH_TEST);
    glDepthFunc(GL_LEQUAL);

    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
    
    SetupViewport();

    // Now actually perform application-specific setup
    glGenVertexArrays(1, &vao);
    glBindVertexArray(vao);

    // Setup of vertex transfer (note we're using the "vertex" object in CodeGell)
    glGenBuffers(1, &pointBuffer);
    glBindBuffer(GL_ARRAY_BUFFER, pointBuffer);

    glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(colorVertex), (GLvoid*)offsetof(colorVertex, x));
    glEnableVertexAttribArray(0);

    glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, sizeof(colorVertex), (GLvoid*)offsetof(colorVertex, r));
    glEnableVertexAttribArray(1);

    boringProgram = GLManager::GetManager()->CompileShaderProgram("render");
    mv_location = glGetUniformLocation(boringProgram, "mv_matrix");
    proj_location = glGetUniformLocation(boringProgram, "proj_matrix");

    return true;
}