Commit 6d52dd0a authored by Luis Penaranda's avatar Luis Penaranda

don't use libnetpbm in MSVC anymore

parent 07a1744f
......@@ -36,7 +36,10 @@
}
#endif
#define PROGNAME "pano_interface"
#ifndef _MSC_VER
#define PROGNAME "pano_interface"
#endif
#define VERT_SHADER_FILE "test_vertex_shader.vert"
#define FRAG_SHADER_FILE "fragment_shader.frag"
......@@ -310,7 +313,10 @@ enum FileType OpenGLCanvas::get_file_type(const char *filename){
void OpenGLCanvas::load_image(const char *new_image){
int width,height;
#ifndef _MSC_VER
// the progname is only used for reading the PNM format
const char * const progname=(char*)(PROGNAME);
#endif
unsigned char *textureBytes=NULL;
int textureSize;
switch(get_file_type(new_image)){
......@@ -320,12 +326,14 @@ void OpenGLCanvas::load_image(const char *new_image){
textureBytes=(unsigned char*)malloc(textureSize);
jpgReadTextureBytes(new_image,textureBytes,&width,&height);
break;
#ifndef _MSC_VER
case PNM:
fprintf(stderr,"input image has PNM format\n");
textureSize=pnmGetTextureSize(progname,new_image);
textureBytes=(unsigned char*)malloc(textureSize);
pnmReadTextureBytes(progname,new_image,textureBytes,&width,&height);
break;
#endif
default: // UNKNOWN
fprintf(stderr,"%s: unknown file format\n",new_image);
exit(-1);
......@@ -352,14 +360,16 @@ void OpenGLCanvas::initializeGL(){
glDepthFunc(GL_LEQUAL);
glHint(GL_PERSPECTIVE_CORRECTION_HINT,GL_NICEST);
#ifndef _MSC_VER
#ifdef __APPLE__
const char * const progname = "PROJ_ROOT_DIR";
#else
// progname is a file name or a path???
const char * const progname = (char*)(PROGNAME);
#endif
fprintf(stderr,"progname=%s\n",progname);
#endif // MSC_VER
read_config_file();
// If the input file does not exist or was not specified.
struct stat testbuf;
......@@ -599,6 +609,7 @@ void OpenGLCanvas::define_triangle_indices(unsigned int * indices, int m, int n)
}
#ifndef _MSC_VER
int OpenGLCanvas::pnmGetTextureSize(const char * const progname, const char * texturePath)
{
struct pam inpam;
......@@ -657,6 +668,7 @@ void OpenGLCanvas::pnmReadTextureBytes(const char * const progname,
pm_close(in_file);
}
#endif
int OpenGLCanvas::jpgGetTextureSize(const char *texturePath)
{
......
......@@ -35,11 +35,13 @@
#endif
#include "chronos.h"
#ifndef _MSC_VER
extern "C" {
#include <ppm.h>
#include <pm.h>
#include <pam.h>
}
#endif
#include <jpeglib.h>
......@@ -66,8 +68,10 @@ protected:
void load_sphere_mesh(float *positions, int m, int n);
float calculate_extent(float fov_rads);
void define_triangle_indices(unsigned int * indices, int m, int n);
#ifndef _MSC_VER
int pnmGetTextureSize(const char *const progname, const char *texturePath);
void pnmReadTextureBytes(const char *const progname, const char *texturePath,unsigned char *textureBytes,int *outImageWidth,int *outImageHeight);
#endif
int jpgGetTextureSize(const char *texturePath);
void jpgReadTextureBytes(const char *texturePath,unsigned char *textureBytes,int *outImageWidth,int *outImageHeight);
char *textFileRead(char *fn);
......
......@@ -45,17 +45,18 @@ LIBS += -lm -lglut -lGL -lGLEW -lnetpbm -ljpeg
win32 {
DEFINES += GLEW_STATIC
INCLUDEPATH += "C:/Program Files (x86)/glew-1.9.0/include"
DEPENDPATH += "C:/Program Files (x86)/glew-1.9.0/include"
INCLUDEPATH += "C:/Program Files (x86)/freeglut/include"
DEPENDPATH += "C:/Program Files (x86)/freeglut/include"
INCLUDEPATH += "C:/Program Files (x86)/GnuWin32/include"
DEPENDPATH += "C:/Program Files (x86)/GnuWin32/include"
LIBS += -L"C:/Program Files (x86)/freeglut/lib"
LIBS += -L"C:/Program Files (x86)/GnuWin32/lib"
LIBS += -L"C:/Program Files (x86)/GnuWin32/bin"
LIBS += -L"C:/Program Files (x86)/glew-1.9.0/lib"
LIBS += -lglew32s -lfreeglut -lglu32 -lopengl32 -llibnetpbm10
PFROOT = "C:/Program Files"
INCLUDEPATH += $${PFROOT}/glew-1.9.0/include
DEPENDPATH += $${PFROOT}/glew-1.9.0/include
INCLUDEPATH += $${PFROOT}/freeglut/include
DEPENDPATH += $${PFROOT}/freeglut/include
INCLUDEPATH += $${PFROOT}/GnuWin32/include
DEPENDPATH += $${PFROOT}/GnuWin32/include
LIBS += -L$${PFROOT}/freeglut/lib
LIBS += -L$${PFROOT}/GnuWin32/lib
LIBS += -L$${PFROOT}/GnuWin32/bin
LIBS += -L$${PFROOT}/glew-1.9.0/lib
LIBS += -lglew32s -lfreeglut -lglu32 -lopengl32 -ljpeg #-llibnetpbm10
}
TARGET = pano_interface_1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment