goat3d

diff goatview/src/goatview.cc @ 92:ae6c5941faac

[goatview] makefile rules to create app bundle and dmg archive [goatview] creating multisampling context
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 18 May 2014 01:19:10 +0300
parents 8b156bc5205b
children 07c0ec4a410d
line diff
     1.1 --- a/goatview/src/goatview.cc	Sat May 17 15:42:10 2014 +0300
     1.2 +++ b/goatview/src/goatview.cc	Sun May 18 01:19:10 2014 +0300
     1.3 @@ -21,6 +21,7 @@
     1.4  static float fov = 60.0;
     1.5  static bool use_nodes = true;
     1.6  static bool use_lighting = true;
     1.7 +static bool use_textures = true;
     1.8  
     1.9  void post_redisplay()
    1.10  {
    1.11 @@ -35,11 +36,16 @@
    1.12  	glview = 0;
    1.13  	scene_model = 0;
    1.14  
    1.15 +	QGLFormat glfmt = QGLFormat::defaultFormat();
    1.16 +	glfmt.setSampleBuffers(true);
    1.17 +	QGLFormat::setDefaultFormat(glfmt);
    1.18 +
    1.19  	QSettings settings;
    1.20  	resize(settings.value("main/size", QSize(1024, 768)).toSize());
    1.21  	move(settings.value("main/pos", QPoint(100, 100)).toPoint());
    1.22  	use_nodes = settings.value("use_nodes", true).toBool();
    1.23  	use_lighting = settings.value("use_lighting", true).toBool();
    1.24 +	use_textures = settings.value("use_textures", true).toBool();
    1.25  
    1.26  	make_center();	// must be first
    1.27  	make_menu();
    1.28 @@ -237,7 +243,7 @@
    1.29  
    1.30  // ---- OpenGL viewport ----
    1.31  GoatViewport::GoatViewport(QWidget *main_win)
    1.32 -	: QGLWidget(QGLFormat(QGL::DepthBuffer))
    1.33 +	: QGLWidget(QGLFormat(QGL::DepthBuffer | QGL::SampleBuffers))
    1.34  {
    1.35  	this->main_win = main_win;
    1.36  	initialized = false;
    1.37 @@ -281,6 +287,8 @@
    1.38  
    1.39  	float ldir[] = {-1, 1, 2, 0};
    1.40  	glLightfv(GL_LIGHT0, GL_POSITION, ldir);
    1.41 +
    1.42 +	glEnable(GL_MULTISAMPLE);
    1.43  }
    1.44  
    1.45  void GoatViewport::resizeGL(int xsz, int ysz)