git-svn-id: svn://db.shs.com.ru/libs@643 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -245,13 +245,14 @@ void Framebuffer::release() {
|
||||
|
||||
|
||||
void Framebuffer::setWriteBuffer(int index) {
|
||||
//QVector<GLenum> buffers; buffers << GL_COLOR_ATTACHMENT0 + index;
|
||||
unsetWriteBuffers();
|
||||
GLenum e = GL_COLOR_ATTACHMENT0 + index;
|
||||
f->glDrawBuffers(1, &e);
|
||||
}
|
||||
|
||||
|
||||
void Framebuffer::setWriteBuffers(int * indeces, int count) {
|
||||
unsetWriteBuffers();
|
||||
QVector<GLenum> buffers;
|
||||
for (int i = 0; i < count; ++i)
|
||||
buffers << GL_COLOR_ATTACHMENT0 + indeces[i];
|
||||
@@ -267,6 +268,12 @@ void Framebuffer::setWriteBuffers() {
|
||||
}
|
||||
|
||||
|
||||
void Framebuffer::unsetWriteBuffers() {
|
||||
QVector<GLenum> buffers(colors.size(), GL_NONE);
|
||||
f->glDrawBuffers(buffers.size(), buffers.constData());
|
||||
}
|
||||
|
||||
|
||||
void Framebuffer::enablePixelBuffer() {
|
||||
pbo.init(f);
|
||||
}
|
||||
|
||||
@@ -56,6 +56,7 @@ public:
|
||||
void setWriteBuffer(int index);
|
||||
void setWriteBuffers(int * indeces, int count);
|
||||
void setWriteBuffers();
|
||||
void unsetWriteBuffers();
|
||||
//void setColorFormat(GLenum format) {color_format = format; is_changed = true;}
|
||||
void enablePixelBuffer();
|
||||
|
||||
|
||||
@@ -405,3 +405,17 @@ Mesh * Primitive::coneFrame(int segments, float width, float length, float heigh
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
Mesh * Primitive::lineFrame(QVector3D p0, QVector3D p1) {
|
||||
Mesh * ret = new Mesh(GL_LINES);
|
||||
QVector<QVector3D> & v(ret->vertices ());
|
||||
QVector<QVector3D> & n(ret->normals ());
|
||||
QVector<QVector2D> & t(ret->texcoords());
|
||||
QVector< Vector2i> & ind(ret->indicesLines());
|
||||
v << p0 << p1;
|
||||
n << QVector3D(0,0,1) << QVector3D(0,0,1);
|
||||
t << QVector2D(0,0) << QVector2D(1,0);
|
||||
ind << Vector2i(0, 1);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -42,6 +42,8 @@ Mesh * arrow(int segments = 16, float thick = 0.04, float angle = 30.); // lengt
|
||||
Mesh * torus(int segments_main = 30, int segments_second = 16, float radius_main = 2.5, float radius_second = 0.5, float end_angle = 360.);
|
||||
|
||||
|
||||
Mesh * lineFrame(QVector3D p0, QVector3D p1);
|
||||
|
||||
Mesh * cubeFrame(float width = 1., float length = 1., float height = 1.);
|
||||
|
||||
Mesh * ellipsoidFrame(int segments_wl, int segments_h, float width = 1., float length = 1., float height = 1.);
|
||||
|
||||
@@ -66,7 +66,10 @@ bool QGLEngineShaders::loadShadersMulti(QOpenGLShaderProgram *& prog, const QStr
|
||||
prog = new QOpenGLShaderProgram();
|
||||
prog->removeAllShaders();
|
||||
QFile f(file);
|
||||
if (!f.open(QIODevice::ReadOnly)) return false;
|
||||
if (!f.open(QIODevice::ReadOnly)) {
|
||||
qDebug() << "[QGLView] Shader" << file << "Error: can`t open file!";
|
||||
return false;
|
||||
}
|
||||
QTextStream ts(&f);
|
||||
QString cur_shader, line, pl, defs = prepareDefines(defines);
|
||||
QOpenGLShader::ShaderType type = 0;
|
||||
|
||||
Reference in New Issue
Block a user