Changeset 5217


Ignore:
Timestamp:
Apr 17, 2008, 2:10:58 PM (15 years ago)
Author:
jack
Message:

Prepared for shared data structures in libanugavis.

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

Legend:

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

    r5216 r5217  
    1616AX_CHECK_GL
    1717AC_SEARCH_LIBS([SDL_Init], [SDL], [],
    18                [AC_MSG_ERROR([Can't link against the SDL library. (LDFLAGS?)])])
     18               [AC_MSG_ERROR([Can't link the SDL library. (LDFLAGS?)])])
     19AC_SEARCH_LIBS([nc_open], [netcdf], [],
     20               [AC_MSG_ERROR([Can't link the NetCDF library. (LDFLAGS?)])])
    1921
    2022# Checks for header files.
    2123AC_CHECK_HEADER([SDL.h], [],
    2224                [AC_MSG_ERROR([Can't find the SDL header. (Check CPPFLAGS?)])])
     25AC_CHECK_HEADER([netcdf.h], [],
     26                [AC_MSG_ERROR([Can't find the NetCDF header. (CPPFLAGS?)])])
    2327
    2428# Checks for typedefs, structures, and compiler characteristics.
  • anuga_work/development/anugavis/src/Makefile.am

    r5216 r5217  
    1 SUBDIRS = anugavis_simple libanugavis
     1SUBDIRS = libanugavis anugavis_simple
  • anuga_work/development/anugavis/src/anugavis_simple/anugavis_simple.c

    r5216 r5217  
    44int main(int argc, char *argv[]){
    55  if(AnugaVis_Init() == -1){
    6     printf("AnugaVis Error: %s", AnugaVis_GetError());
     6    printf("AnugaVis_Init() Error: %s", AnugaVis_GetError());
    77    return 1;
    88  }
  • anuga_work/development/anugavis/src/libanugavis/Makefile.am

    r5216 r5217  
    22
    33lib_LTLIBRARIES = libanugavis.la
    4 libanugavis_la_SOURCES = anugavis.h error.c init.c
     4libanugavis_la_SOURCES = anugavis.h error.c error.h globals.c globals.h init.c
    55libanugavis_la_LDFLAGS = -no-undefined -version-info 1:0:0
  • anuga_work/development/anugavis/src/libanugavis/anugavis.h

    r5216 r5217  
    22#define ANUGAVIS_H
    33
     4/* Start and stop the visualiser. AnugaVis_Init() returns -1 on
     5 * error. To get detailed error information, use AnugaVis_GetError().
     6 */
    47extern int AnugaVis_Init(void);
    58extern void AnugaVis_DeInit(void);
    69
     10/* Get detailed error information. The returned string should not be
     11 * freed by the caller.
     12 */
    713extern char* AnugaVis_GetError(void);
    8 extern void AnugaVis_SetError(const char *format, ...);
    914
    1015#endif
  • anuga_work/development/anugavis/src/libanugavis/error.c

    r5216 r5217  
    11#include <SDL.h>
    22#include "anugavis.h"
     3#include "error.h"
    34
    45#define MAX_ERROR_LEN 50
     
    1617  va_end(args);
    1718}
     19
     20void AnugaVis_SDLError(void){
     21  AnugaVis_SetError("SDL Error: %s", SDL_GetError());
     22  SDL_ClearError();
     23}
  • anuga_work/development/anugavis/src/libanugavis/init.c

    r5216 r5217  
    11#include <SDL.h>
    22#include "anugavis.h"
     3#include "error.h"
     4#include "globals.h"
    35
    46int AnugaVis_Init(void){
    5   if(SDL_Init(SDL_INIT_VIDEO) == -1){
    6     AnugaVis_SetError("SDL Error: %s", SDL_GetError());
    7     SDL_ClearError();
     7  if((SDL_Init(SDL_INIT_VIDEO) == -1) ||
     8     (SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5) == -1) ||
     9     (SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5) == -1) ||
     10     (SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5) == -1) ||
     11     (SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16) == -1) ||
     12     (SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1) == -1) ||
     13     ((screen = SDL_SetVideoMode(640, 480, 16, SDL_OPENGL)) == NULL)){
     14    AnugaVis_SDLError();
    815    return -1;
    916  }
Note: See TracChangeset for help on using the changeset viewer.