|
From: Robert S L. <rob...@av...> - 2001-12-11 14:37:37
|
> > > Typical steps would be:
> > >
> > > FXuchar *data;
> > > FXint width,height,qual;
> > > FXColor trans;
> > > FXFileStream store;
> > >
> > > store.open(filename,FXStreamLoad);
> > > fxloadJPG(store,data,trans,width,height,qual);
> > > store.close();
> > >
> > > Note we have blatantly ignored errors; production code would test for
> > > various errors, of course.
> > >
> > > Then, pass to OpenGL:
> > >
> > > glPixelStorei(GL_UNPACK_ALIGNMENT,1);
> > > glGenTextures(1, &texname);
> > > glBindTexture(GL_TEXTURE_2D,texname);
> > > glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT);
> > > glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT);
> > > glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
> > > glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
> > >
> > > glTexImage2D(GL_TEXTURE_2D,0,GL_RGB,width,height,0,GL_RGB,GL_UNSIGNED_BYT
> > >E,data);
> >
> >
> > It would seem as there is a problem with the above example.
> > That is, where is the data stored? All we have is a pointer
> > to the data. When we call FXFileStream.close() does the data
> > persist? Has the FXFileStream object allocated the appropriate
> > room? Or do we need to save the data before calling close()
> > e.g. using fxSaveJPG()?
> >
> > -cheers, bob
>
> fxloadJPG allocates the array; it must be freed using FXFREE(&data).
>
> Sorry, I should have mentioned that.
>
> - Jeroen
Thank you for your help thus far Jeroen. It seems to be working
now. Ok, now i would like to store the JPEG image as part of
the binary file. i have already used reswrap to save the file
directly into the executable. e.g. i have this in my header file:
/* Generated by reswrap from file water32x32.jpg */
const unsigned char m_Water32x32[]={
0xff,0xd8,0xff,0xe0,0x00,0x10,0x4a,0x46,0x49,0x46,0x00,0x01,0x01,0x00,0x00,0x01,
...
Now, what are the steps to take to extract the RGB data.
If i understand correctly, i first load this data into
a FOXFileStream object, and then extract the RGB data.
Is it the same 3 steps (open, load, and close) except
instead of the filename i pass the array name?
-cheers, bob
--
Robert S. Laramee
Junior Researcher, VRVis, www.vrvis.at
phone: +43 (316) 787-1740
fax: +43 (316) 787-777
http://www.daimyo.org/bsod/
|