Com.jme.image.Image question

Hello,



I would like to extend com.jme.image.Image so I can add more image types.



Would it be possible to make the member variables protected instead of private so Image can be extended?



Thanks,

Gregg

I’m a little confused what type you’d like to add. Image just holds generic image data, the type flag is the byte layout. Is that what you want to add to? For example there is RGB888. If that is what you want to add to, let me know, and I can put it directly into Image rather than making you extend it.

There is a freeware program called glfont2 that converts truetype fonts to a texture file. It appears to be similar to what jme already uses except it has some extra data in the texture file to help with sizing the characters.



glFont2 comes with a c++ class that has code to load and render the texture file and I have converted it to a Java class. The image data is in the form of GL_LUMINANCE8_ALPHA8. To accomodate the image format I created my own TextureState class from LWJGLTextureState and added GL_LUMINANCE8_ALPHA8 to the imageComponents array and GL_LUMINANCE_ALPHA to the imageFormats array. To make use of the new image format I needed to extend com.jme.image.Image to add a type that has the correct index value for the new TextureState class.



I’m doing it this way in an attempt to keep from having to modify jME code. Because I want to use the existing Texture class I need to derive a class from com.jme.image.Image. Since Image enforces a range for type I need to override the constructor and the setType method to allow for the new type. Because the member variables in Image are private I still don’t have access to them even if I override the methods.



Sorry for the long winded reply. . . :slight_smile:



I am in the process of writing a patch modeler, 3d paint, and texturing system which I hope to eventually turn into a ‘machinima’ system (another long story :D) and I have decided I don’t want to mix Java gui with opengl. Since I haven’t been able to find a ready made gui api for opengl I’m writing my own.



Anyway, I’ve looked at several different approaches for rendering fonts and I think glfont2 does a better job than anything I’ve seen so far.



Gregg

Ok, Image attributes are now:


//image attributes
    protected int type;
    protected int width;
    protected int height;
    protected ByteBuffer data;



that is in CVS. Let me know if there is anything else you'll need.

Got it.



Thanks,

Gregg