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

don't use libnetpbm in MSVC anymore

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