. . .
widgetVolumen = new Rendering(centralWidget);
widgetVolumen
->setObjectName
(QString::fromUtf8("wVolumen"));
widgetVolumen
->setGeometry
(QRect(230,
10,
531,
471));
if(wVolumen->isValid())
{
printf("wVolumen valid context!\n");
cx
= new QGLContext(widgetVolumen
->context
()->format
());
/*if(cx->create())
{
printf("Funciono contexto\n");
}
else
{
printf("No funciono contexto\n");
}*/
}
else
{
printf("Invalid context!\n");
exit(-1);
}
if(widgetVolumen->isSharing())
{
printf("Volumen GLcontext is shared!\n");
}
else
{
printf("Not Sharing!\n");
}
widgetPlane1 = new Rendering(cx, framePlane1, widgetVolumen);
widgetPlane1
->setObjectName
(QString::fromUtf8("wCorte1"));
widgetPlane1
->setGeometry
(QRect(5,
4,
241,
191));
QGLContext *cx;
. . .
widgetVolumen = new Rendering(centralWidget);
widgetVolumen->setObjectName(QString::fromUtf8("wVolumen"));
widgetVolumen->setGeometry(QRect(230, 10, 531, 471));
if(wVolumen->isValid())
{
printf("wVolumen valid context!\n");
cx = new QGLContext(widgetVolumen->context()->format());
/*if(cx->create())
{
printf("Funciono contexto\n");
}
else
{
printf("No funciono contexto\n");
}*/
}
else
{
printf("Invalid context!\n");
exit(-1);
}
if(widgetVolumen->isSharing())
{
printf("Volumen GLcontext is shared!\n");
}
else
{
printf("Not Sharing!\n");
}
widgetPlane1 = new Rendering(cx, framePlane1, widgetVolumen);
widgetPlane1->setObjectName(QString::fromUtf8("wCorte1"));
widgetPlane1->setGeometry(QRect(5, 4, 241, 191));
To copy to clipboard, switch view to plain text mode
bool FileIO
::readFileRaw(const QString & filename
) {
return false;
pixels = new GLubyte [length_x * length_y * length_z];
if (pixels==NULL)
{
tr("Out of memory"),
}
else
{
/*read data*/
file.read((char*)pixels ,length_x * length_y * length_z);
}
glPixelStorei(GL_UNPACK_ALIGNMENT,1);
glActiveTexture(GL_TEXTURE0);
glGenTextures(1,&texName);
glBindTexture(GL_TEXTURE_3D_EXT,texName);
// set the texture parameters
glTexParameteri(GL_TEXTURE_3D_EXT, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_3D_EXT, GL_TEXTURE_WRAP_T, GL_CLAMP);
glTexParameteri(GL_TEXTURE_3D_EXT, GL_TEXTURE_WRAP_R, GL_CLAMP);
glTexParameteri(GL_TEXTURE_3D_EXT, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_3D_EXT, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexImage3DEXT(GL_TEXTURE_3D_EXT,0,GL_INTENSITY8,length_x,length_y,length_z,0,GL_LUMINANCE,GL_UNSIGNED_BYTE,pixels);
file.close();
return true;
}
bool FileIO::readFileRaw(const QString & filename)
{
QFile file(filename);
if (!file.open(QIODevice::ReadOnly))
return false;
pixels = new GLubyte [length_x * length_y * length_z];
if (pixels==NULL)
{
QMessageBox::information(this, tr("Read_data"),
tr("Out of memory"),
QMessageBox::Ok| QMessageBox::Escape);
}
else
{
/*read data*/
QApplication::setOverrideCursor(Qt::WaitCursor);
file.read((char*)pixels ,length_x * length_y * length_z);
}
glPixelStorei(GL_UNPACK_ALIGNMENT,1);
glActiveTexture(GL_TEXTURE0);
glGenTextures(1,&texName);
glBindTexture(GL_TEXTURE_3D_EXT,texName);
// set the texture parameters
glTexParameteri(GL_TEXTURE_3D_EXT, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_3D_EXT, GL_TEXTURE_WRAP_T, GL_CLAMP);
glTexParameteri(GL_TEXTURE_3D_EXT, GL_TEXTURE_WRAP_R, GL_CLAMP);
glTexParameteri(GL_TEXTURE_3D_EXT, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_3D_EXT, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexImage3DEXT(GL_TEXTURE_3D_EXT,0,GL_INTENSITY8,length_x,length_y,length_z,0,GL_LUMINANCE,GL_UNSIGNED_BYTE,pixels);
file.close();
return true;
}
To copy to clipboard, switch view to plain text mode
Bookmarks