chunkstream version fixedleaselication
git-svn-id: svn://db.shs.com.ru/libs@3 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -18,15 +18,92 @@
|
||||
|
||||
#include <QApplication>
|
||||
#include <QCleanlooksStyle>
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include "mainwindow.h"
|
||||
#include <GL/glew.h>
|
||||
//#include "mainwindow.h"
|
||||
#include "unistd.h"
|
||||
#include <GL/freeglut.h>
|
||||
|
||||
/*void display ()
|
||||
{
|
||||
qDebug() << (const char*)glGetString(GLUT_VERSION);
|
||||
qDebug() << (const char*)glGetString(GL_SHADING_LANGUAGE_VERSION);
|
||||
usleep(200000);
|
||||
}*/
|
||||
template <typename T, int N>
|
||||
struct garray {
|
||||
garray(T * _i) {for (int i = 0; i < N; ++i) _c[i] = &(_i[i]);}
|
||||
T * _c[N];
|
||||
garray<T, N> & operator =(const garray<T, N> & o) {for (int i = 0; i < N; ++i) *_c[i] = *(o._c[i]); return *this;};
|
||||
template <int ON>
|
||||
garray<T, N> & operator =(const garray<T, ON> & o) {for (int i = 0; i < qMin(N, ON); ++i) *_c[i] = *(o._c[i]); return *this;};
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
class gvec3 {
|
||||
public:
|
||||
gvec3(T def = T()) {x = y = z = def;}
|
||||
union {
|
||||
T xyz[3];
|
||||
struct {T x, y, z;};
|
||||
};
|
||||
private:
|
||||
T _c[3];
|
||||
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
QDebug operator<<(QDebug d, const gvec3<T> & c) {
|
||||
d.nospace() << "(" << c.x << ", " << c.y << ", " << c.z << ")";
|
||||
return d.space();
|
||||
}
|
||||
|
||||
typedef gvec3<float> vec3;
|
||||
typedef gvec3<int> ivec3;
|
||||
|
||||
int main(int argc, char ** argv) {
|
||||
/*float f[3] = {0., 1., 2.};
|
||||
float f2[3] = {-1., -1., -1.};
|
||||
garray<float, 3> gar(f2);
|
||||
qDebug() << f2[0] << f2[1] << f2[2];
|
||||
gar = garray<float, 3>((float[3]){f[2], f[1], f[0]});
|
||||
qDebug() << f2[0] << f2[1] << f2[2];*/
|
||||
/*vec3 v0, v1(20);
|
||||
v0.y = 10;
|
||||
qDebug() << v0 << v1;*/
|
||||
|
||||
/*glutInit ( &argc, argv );
|
||||
glutInitDisplayMode ( GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH );
|
||||
glutInitWindowSize ( 500, 500 );
|
||||
|
||||
// prepare context for 3.3
|
||||
glutInitContextVersion ( 3, 3 );
|
||||
glutInitContextFlags ( GLUT_FORWARD_COMPATIBLE | GLUT_DEBUG );
|
||||
glutInitContextProfile ( GLUT_CORE_PROFILE );
|
||||
glutCreateWindow ( "Geometry shader example - particles" );
|
||||
glutDisplayFunc ( display );
|
||||
glewInit ();
|
||||
if ( !GLEW_VERSION_3_3 )
|
||||
{
|
||||
printf ( "OpenGL 3.3 not supported.\n" );
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
glutMainLoop();
|
||||
*/
|
||||
return 0;
|
||||
QApplication a(argc, argv);
|
||||
/*QGLFormat f;
|
||||
f.setVersion(3, 3);
|
||||
f.setSampleBuffers(true);
|
||||
f.setProfile(QGLFormat::CoreProfile);
|
||||
QGLFormat::setDefaultFormat(f);*/
|
||||
//QApplication::setStyle(new QCleanlooksStyle());
|
||||
QDir::setCurrent(a.applicationDirPath());
|
||||
//a.setWindowIcon(QIcon(":/icons/peri4_paint.png"));
|
||||
MainWindow w;
|
||||
w.show();
|
||||
//MainWindow w;
|
||||
//w.show();
|
||||
return a.exec();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user