FLTK logo

Re: Load png images from fltk for opengl textures

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.opengl  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: Load png images from fltk for opengl textures D. Zimmer Apr 11, 2006  
 
> Hi guys,
>
>
> I was wondering if it is possible for FLTK to load png images in a format that can be used for OPENGL texture maps. Cos i know FLTK has this Fl_PNG_IMAGE class that is able to load png file. THx
>
>
>

Never done it, but it looks like you can get the image buffer from:

  GLvoid *pixels = png_image->data();

and check the format using:

  GLenum format;

  switch(png_image->d())
  {
   case 4: format = GL_RGBA; break;
   case 3: format = GL_RGB; break;
   default: foramt = -1; /* not sure */
  }

use the above values in a call to glTexImage2D()

Don.



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'.