#include "qgl.h"
#include "qapplication.h"
#include "qimage.h"
#include "iostream.h"
#include "GL/gl.h"
{
public:
void paintGL();
void resizeGL(int w,int h);
void divide();
protected:
};
data.load(filename);
resize(data.size());
}
void Radha::paintGL(){
int k,i,j,count=0,flag=1;
<PROBLEM>
uchar *temp;
uchar *img;
temp=gldata.bits();
for(j=0;j<data.width()*data.height();j++){ //for reading the half image in img array
if(count==data.width()/2){
flag==1-flag;
count=0;
}
if(flag==1)
img[j++]=temp[i];
count++;
}
glDrawPixels(data.width(),data.height(),GL_RGBA,GL_UNSIGNED_BYTE,img);
}
void Radha::resizeGL(int w,int h){
glViewport(0,0,w,h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0,w,0,h,-1,1);
glMatrixMode(GL_MODELVIEW);
}
int main(int argc,char** argv){
Radha pw(argv[1]);
pw.showFullScreen();
return app.exec();
}
#include "qgl.h"
#include "qapplication.h"
#include "qimage.h"
#include "iostream.h"
#include "GL/gl.h"
class Radha : public QGLWidget
{
public:
Radha(const QString &filename,QWidget *parent=0);
void paintGL();
void resizeGL(int w,int h);
void divide();
protected:
QImage data,gldata;
};
Radha::Radha(const QString &filename,QWidget *parent):QGLWidget(parent){
data.load(filename);
gldata=QGLWidget::convertToGLFormat(data);
resize(data.size());
}
void Radha::paintGL(){
int k,i,j,count=0,flag=1;
<PROBLEM>
uchar *temp;
uchar *img;
temp=gldata.bits();
for(j=0;j<data.width()*data.height();j++){ //for reading the half image in img array
if(count==data.width()/2){
flag==1-flag;
count=0;
}
if(flag==1)
img[j++]=temp[i];
count++;
}
glDrawPixels(data.width(),data.height(),GL_RGBA,GL_UNSIGNED_BYTE,img);
}
void Radha::resizeGL(int w,int h){
glViewport(0,0,w,h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0,w,0,h,-1,1);
glMatrixMode(GL_MODELVIEW);
}
int main(int argc,char** argv){
QApplication app(argc,argv);
Radha pw(argv[1]);
pw.showFullScreen();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks