FLTK logo

[fltk.general] Re: Loading OpenGL textures from FLTK

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.general  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: Loading OpenGL textures from FLTK Manolo Oct 10, 2020  
 
You can get an Fl_RGB_Image object from a .png file with:
    https://www.fltk.org/doc-1.3/classFl__PNG__Image.html#a64b3f34f7b97784763802e39e2db3fc2
and similarly with .jpeg:
   https://www.fltk.org/doc-1.3/classFl__JPEG__Image.html#a8a12107808d6e86cd82b7bede8637aeb
and .bmp:
   https://www.fltk.org/doc-1.3/classFl__BMP__Image.html#a1abb2ebb6ca113fd03a967b66624c868

In all these cases, the resulting Fl_RGB_Image object, supposing you call it img, will tell you
if its RGB (img->d() == 3) or RGBA (img->d() == 4)and its width (img->w()) and height (img->h()).
In some cases, the row length is bigger than img->w()*img->d(). In that case img->ld() is != 0
and gives that length. Finally, you get the address of the first byte of the RGB or RGBA data
by img->array of type const unsigned char *. That should put you in the position to build a texture.

--
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/87f4fbe3-1ed2-4b80-a974-4a39dab90c26n%40googlegroups.com.
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.