Пример #1
0
// Entry point
int main(int argc, char* argv[])
{
	// Init GLUT and OpenGL environment
	glutInit(&argc, argv);

	// Set display mode
	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH);

	// Set display size
	glutInitWindowSize(512, 512);

	// Create the window and set window's name
	glutCreateWindow("Loading OBJ");

	// Set the callback function called at when window's size is chenged
	glutReshapeFunc(Reshape);

	// Set the callback function called at when there is a need drawing
	glutDisplayFunc(Display);

	// Init GLEW
	glewInit();

	// Init the rendering settings needed once only
	InitRenderingContext();

	// Main loop
	glutMainLoop();

	delete g_obj;

	return 0;
}
NS_IMETHODIMP DeviceContextImpl::CreateRenderingContext(nsIWidget *aWidget, nsIRenderingContext *&aContext)
{
    nsresult rv;

    aContext = nsnull;
    nsCOMPtr<nsIRenderingContext> pContext;
    rv = CreateRenderingContextInstance(*getter_AddRefs(pContext));
    if (NS_SUCCEEDED(rv)) {
        rv = InitRenderingContext(pContext, aWidget);
        if (NS_SUCCEEDED(rv)) {
            aContext = pContext;
            NS_ADDREF(aContext);
        }
    }

    return rv;
}