summaryrefslogtreecommitdiff
path: root/progs/demos/rain.cxx
diff options
context:
space:
mode:
authorKarl Schultz <kschultz@freedesktop.org>2002-01-16 00:48:43 +0000
committerKarl Schultz <kschultz@freedesktop.org>2002-01-16 00:48:43 +0000
commit164ce1220232e03660633e16681737782c73059e (patch)
tree31ff2ee201ee8063f60e7adb5fabdf35683d5efc /progs/demos/rain.cxx
parent83356781e104cea412da9bd6d1127b56e0d7a6c4 (diff)
Demo updates for Windows (Robert Bergkvist)
Diffstat (limited to 'progs/demos/rain.cxx')
-rw-r--r--progs/demos/rain.cxx24
1 files changed, 15 insertions, 9 deletions
diff --git a/progs/demos/rain.cxx b/progs/demos/rain.cxx
index 4a7ecde3c8..e18397862f 100644
--- a/progs/demos/rain.cxx
+++ b/progs/demos/rain.cxx
@@ -11,15 +11,20 @@
#include <math.h>
#include <time.h>
#include <GL/glut.h>
+#ifndef M_PI
+#define M_PI 3.14159265
+#endif
#include "particles.h"
extern "C" {
-#include "image.h"
+#include "readtex.h"
}
-#ifdef WIN32
+#ifdef _WIN32
#include <windows.h>
#include <mmsystem.h>
+#include "particles.cxx"
+#include "readtex.c"
#endif
#ifdef XMESA
@@ -297,20 +302,21 @@ static void key(unsigned char key, int x, int y)
static void inittextures(void)
{
- IMAGE *img;
+ GLubyte *img;
+ GLint width,height;
+ GLenum format;
GLenum gluerr;
glGenTextures(1,&groundid);
glBindTexture(GL_TEXTURE_2D,groundid);
- if(!(img=ImageLoad("s128.rgb"))) {
- fprintf(stderr,"Error reading a texture.\n");
- exit(-1);
+ if(!(img=LoadRGBImage("../images/s128.rgb",&width,&height,&format))){
+ fprintf(stderr,"Error reading a texture.\n");
+ exit(-1);
}
-
glPixelStorei(GL_UNPACK_ALIGNMENT,4);
- if((gluerr=(GLenum)gluBuild2DMipmaps(GL_TEXTURE_2D, 3, img->sizeX, img->sizeY, GL_RGB,
- GL_UNSIGNED_BYTE, (GLvoid *)(img->data)))) {
+ if((gluerr=(GLenum)gluBuild2DMipmaps(GL_TEXTURE_2D, 3, width, height,GL_RGB,
+ GL_UNSIGNED_BYTE, (GLvoid *)(img)))) {
fprintf(stderr,"GLULib%s\n",gluErrorString(gluerr));
exit(-1);
}