Changeset 5220


Ignore:
Timestamp:
Apr 21, 2008, 1:02:58 PM (16 years ago)
Author:
jack
Message:

anugavis: Started work on simple height quantities.

Location:
anuga_work/development/anugavis
Files:
3 added
10 edited

Legend:

Unmodified
Added
Removed
  • anuga_work/development/anugavis/configure.ac

    r5217 r5220  
    33
    44AC_PREREQ([2.56])
    5 AC_INIT([ANUGA OpenGL Visualiser], [alpha], [u4112456@anu.edu.au])
     5AC_INIT([ANUGA SWW Visualiser], [alpha], [u4112456@anu.edu.au])
    66AM_INIT_AUTOMAKE([-Wall -Werror foreign])
    77AC_CONFIG_SRCDIR([src/libanugavis/anugavis.h])
     
    1515# Checks for libraries.
    1616AX_CHECK_GL
    17 AC_SEARCH_LIBS([SDL_Init], [SDL], [],
    18                [AC_MSG_ERROR([Can't link the SDL library. (LDFLAGS?)])])
     17AM_PATH_SDL([1.2.12], [], [AC_MSG_ERROR([SDL is required to build.])])
     18AC_CACHE_CHECK([for SDL library path],
     19               [anugavis_cv_LIB_SDLPATH],
     20               [anugavis_cv_LIB_SDLPATH=""
     21                for token in `sdl-config --libs`; do
     22                  case $token in
     23                  -L*)
     24                    anugavis_cv_LIB_SDLPATH="$anugavis_cv_LIB_SDLPATH $token" ;;
     25                  esac
     26                done])
     27SDL_LIBPATH="$anugavis_cv_LIB_SDLPATH"
     28AC_SUBST([SDL_LIBPATH])
    1929AC_SEARCH_LIBS([nc_open], [netcdf], [],
    2030               [AC_MSG_ERROR([Can't link the NetCDF library. (LDFLAGS?)])])
    21 
    2231# Checks for header files.
    23 AC_CHECK_HEADER([SDL.h], [],
    24                 [AC_MSG_ERROR([Can't find the SDL header. (Check CPPFLAGS?)])])
    2532AC_CHECK_HEADER([netcdf.h], [],
    2633                [AC_MSG_ERROR([Can't find the NetCDF header. (CPPFLAGS?)])])
  • anuga_work/development/anugavis/src/anugavis_simple/Makefile.am

    r5216 r5220  
    11bin_PROGRAMS = anugavis_simple
    22anugavis_simple_SOURCES = anugavis_simple.c
    3 anugavis_simple_CPPFLAGS = -I../libanugavis
     3anugavis_simple_CPPFLAGS = -I@abs_top_srcdir@/src/libanugavis
    44anugavis_simple_LDADD = ../libanugavis/libanugavis.la
  • anuga_work/development/anugavis/src/anugavis_simple/anugavis_simple.c

    r5217 r5220  
    33
    44int main(int argc, char *argv[]){
    5   if(AnugaVis_Init() == -1){
     5  if(AnugaVis_Init(640, 480, "") == -1){
    66    printf("AnugaVis_Init() Error: %s", AnugaVis_GetError());
    77    return 1;
  • anuga_work/development/anugavis/src/libanugavis/Makefile.am

    r5217 r5220  
    22
    33lib_LTLIBRARIES = libanugavis.la
    4 libanugavis_la_SOURCES = anugavis.h error.c error.h globals.c globals.h init.c
    5 libanugavis_la_LDFLAGS = -no-undefined -version-info 1:0:0
     4libanugavis_la_SOURCES = anugavis.h \
     5                         error.c \
     6                         error.h \
     7                         globals.c \
     8                         globals.h \
     9                         height_quantity.c \
     10                         height_quantity.h \
     11                         init.c
     12libanugavis_la_CFLAGS = @SDL_CFLAGS@
     13libanugavis_la_LIBADD = -lSDL
     14libanugavis_la_LDFLAGS = @SDL_LIBPATH@ -no-undefined -version-info 0:0:0
  • anuga_work/development/anugavis/src/libanugavis/anugavis.h

    r5217 r5220  
    55 * error. To get detailed error information, use AnugaVis_GetError().
    66 */
    7 extern int AnugaVis_Init(void);
     7extern int AnugaVis_Init(int width, int height, const char *swwFilePath);
    88extern void AnugaVis_DeInit(void);
     9
     10/* Define (or redefine if already defined a simple height quantity with the
     11 * given offset, scale, and color. Returns 0 on success, -1 on error.
     12 */
     13extern int AnugaVis_DefineHeightQuantity(char *name,
     14                                         double offset, double scale,
     15                                         int red, int green, int blue);
     16/* Undefine a given simple height quantity.
     17 */
     18extern void AnugaVis_UndefineHeightQuantity(char *name);
    919
    1020/* Get detailed error information. The returned string should not be
  • anuga_work/development/anugavis/src/libanugavis/error.c

    r5217 r5220  
     1#include <stdarg.h>
    12#include <SDL.h>
    23#include "anugavis.h"
    34#include "error.h"
    45
    5 #define MAX_ERROR_LEN 50
     6#define MAX_ERROR_LEN 100
    67
    78static char error[MAX_ERROR_LEN];
  • anuga_work/development/anugavis/src/libanugavis/error.h

    r5217 r5220  
    44/* Set the error message with a printf-style format string.
    55 */
    6 extern void AnugaVis_SetError(const char *format, ...);
     6void AnugaVis_SetError(const char *format, ...);
    77
    88/* Report a SDL error.
    99 */
    10 extern void AnugaVis_SDLError(void);
     10void AnugaVis_SDLError(void);
     11
    1112#endif
  • anuga_work/development/anugavis/src/libanugavis/globals.c

    r5217 r5220  
    22#include "globals.h"
    33
    4 SDL_Surface *screen;
     4ANUGAVIS anugavis;
  • anuga_work/development/anugavis/src/libanugavis/globals.h

    r5217 r5220  
    33
    44#include <SDL.h>
     5#include "height_quantity.h"
    56
    6 extern SDL_Surface *screen;
     7typedef struct{
     8  SDL_Surface *screen;
     9  struct height_quantity_simple *heights;
     10} ANUGAVIS;
     11
     12extern ANUGAVIS anugavis;
    713
    814#endif
  • anuga_work/development/anugavis/src/libanugavis/init.c

    r5217 r5220  
    44#include "globals.h"
    55
    6 int AnugaVis_Init(void){
     6int AnugaVis_Init(int width, int height, const char *swwFilePath){
    77  if((SDL_Init(SDL_INIT_VIDEO) == -1) ||
    88     (SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5) == -1) ||
     
    1111     (SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16) == -1) ||
    1212     (SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1) == -1) ||
    13      ((screen = SDL_SetVideoMode(640, 480, 16, SDL_OPENGL)) == NULL)){
     13     ((anugavis.screen =
     14       SDL_SetVideoMode(width, height, 16, SDL_OPENGL)) == NULL)){
    1415    AnugaVis_SDLError();
    1516    return -1;
    1617  }
     18  anugavis.heights = NULL;
     19  return 0;
    1720}
    1821
    1922void AnugaVis_DeInit(void){
     23  while(anugavis.heights != NULL)
     24    AnugaVis_UndefineHeightQuantity(anugavis.heights->name);
    2025  SDL_Quit();
    2126}
Note: See TracChangeset for help on using the changeset viewer.