ホーム » 2023 » 6月 » 27

日別アーカイブ: 2023/06/27

2023年6月
 123
45678910
11121314151617
18192021222324
252627282930  

カテゴリー

アーカイブ

ブログ統計情報

  • 80,470 アクセス



GLUT を使用した 3D データの表示

個人的なメモです.
4 年位前に作成したコードで,凹多角形がうまく処理できていないものがあったのでその変更.

#include	"glut_cg.hxx"
#include	"gonsa_to.hxx"

#define		TIMING_DN	1000

//	int	_tmain	(int argc, _TCHAR* argv[])
int		main	(int argc,   char* argv[])
{
	{
		GonsA	gnsa ;
		{
			tstring	buf ;	buf.resize(1000) ;
			while (std::terr << _T("file ? =") , std::tin.getline(&buf[0],buf.size()))
			{
				tstring	str = buf.c_str() ;
				if 	(str == _T("q"))    {	break ;		}
				else if (str == _T("Q"))    {	break ;		}
				str = ::QuotM_Del_All(str) ;
				if (str.empty())            {	continue ;	}
				if (::File_IsNothing(str))  {	continue ;	}
				tstring	in_file = str ;
				gnsa = ::To_GonsA(in_file.c_str()) ;
				gnsa = ::GonsA_Triangulation(gnsa) ;		//	2023/06/27
				gnsa = ::GonsA_CalcNormal   (gnsa) ;		//	2023/06/27
				if (gnsa.size() > 0)        {	break ;		}
				}
			if (gnsa.size() == 0)           {	return	0 ;		}
			}
		::set_GonsA(gnsa) ;
		::set_Extent(::GonsA_GetExtent(gnsa)) ;
		}
	::glutInitWindowPosition(200,200) ;
	::glutInitWindowSize    (600,400) ;
	::glutInitDisplayMode   (GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH) ;
	::glutInit              (&argc,argv) ;
	::glutCreateWindow      (argv[0]) ;
	::glutReshapeFunc       (cv_resize) ;
	::glutDisplayFunc       (cg_display) ;
	::glutKeyboardFunc      (cv_keyboard) ;
	::glutMouseFunc         (cv_mouse) ;
	::glutMotionFunc        (cv_motion) ;
	::glutTimerFunc         (TIMING_DN,cv_timer,TIMING_DN) ;
	::cv_init               () ;
	{
		::glEnable(GL_LIGHTING) ;
		::glEnable(GL_LIGHT0) ;
		}
	::glutMainLoop          () ;
	return	0 ;
	}

#include	"messbar.cxx"

t_gl_b_3.cpp
t_gl_b_3.exe

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.