From 50f0dd331f8168fb5b2cd60c70178fad627b7fb6 Mon Sep 17 00:00:00 2001 From: pixel Date: Sat, 27 Nov 2004 21:44:15 +0000 Subject: Large dos2unix commit... --- gltest.cpp | 162 ++++++++++++++++++++++++++++++------------------------------- 1 file changed, 81 insertions(+), 81 deletions(-) (limited to 'gltest.cpp') diff --git a/gltest.cpp b/gltest.cpp index 7965fa7..7e69c3a 100644 --- a/gltest.cpp +++ b/gltest.cpp @@ -1,81 +1,81 @@ -#include -#include "generic.h" -#include "Main.h" -#include "glbase.h" -#include "gltexture.h" - -CODE_BEGINS -virtual int startup() throw (GeneralException) { - Uint8 * texture; - verbosity = M_INFO; - mogltk::glbase::setup(); - - mogltk::texture * mytex = new mogltk::texture(256, 256); - - texture = (Uint8 *) mytex->GetSurface()->pixels; - - for (int y = 0; y < 256; y++) { - for (int x = 0; x < 256; x++) { - int r = random() % 256; - texture[(x + y * 256) * 4 + 0] = r; - texture[(x + y * 256) * 4 + 1] = r; - texture[(x + y * 256) * 4 + 2] = r; - texture[(x + y * 256) * 4 + 3] = 255; - } - } - - SDL_Surface * s = SDL_LoadBMP("pattern6.bmp"); - SDL_BlitSurface(s, NULL, mytex->GetSurface(), NULL); -/* - for (int y = 0; y < 256; y += 2) { - for (int x = 0; x < 256; x += 2) { - texture[(x + y * 256) * 4 + 0] = 255; - texture[(x + y * 256) * 4 + 1] = 255; - texture[(x + y * 256) * 4 + 2] = 255; - texture[(x + y * 256) * 4 + 3] = 255; - } - } -*/ - mytex->Generate(); - - mogltk::glbase::Enter2DMode(); - - mytex->Bind(); - glBegin(GL_TRIANGLE_STRIP); - glTexCoord2i(0, 0); - glVertex2f(50, 50); - glTexCoord2i(511, 0); - glVertex2f(561, 50); - glTexCoord2i(0, 511); - glVertex2f(50, 561); - glTexCoord2i(511, 511); - glVertex2f(561, 561); - glEnd(); - - mogltk::texture::Unbind(); - glBegin(GL_TRIANGLE_STRIP); -// glTexCoord2i(0, 0); - glColor3d(0, 0, 0); - glVertex2i(400, 100); -// glTexCoord2i(256, 0); - glColor3d(1, 0, 0); - glVertex2i(450, 100); -// glTexCoord2i(0, 256); - glColor3d(0, 1, 0); - glVertex2i(400, 150); -// glTexCoord2i(256, 256); - glColor3d(0, 0, 1); - glVertex2i(450, 150); - glEnd(); - mogltk::glbase::Leave2DMode(); - - mogltk::glbase::Flip(); - -// sleep(15); - getchar(); - - delete mytex; - - return 0; -} -CODE_ENDS +#include +#include "generic.h" +#include "Main.h" +#include "glbase.h" +#include "gltexture.h" + +CODE_BEGINS +virtual int startup() throw (GeneralException) { + Uint8 * texture; + verbosity = M_INFO; + mogltk::glbase::setup(); + + mogltk::texture * mytex = new mogltk::texture(256, 256); + + texture = (Uint8 *) mytex->GetSurface()->pixels; + + for (int y = 0; y < 256; y++) { + for (int x = 0; x < 256; x++) { + int r = random() % 256; + texture[(x + y * 256) * 4 + 0] = r; + texture[(x + y * 256) * 4 + 1] = r; + texture[(x + y * 256) * 4 + 2] = r; + texture[(x + y * 256) * 4 + 3] = 255; + } + } + + SDL_Surface * s = SDL_LoadBMP("pattern6.bmp"); + SDL_BlitSurface(s, NULL, mytex->GetSurface(), NULL); +/* + for (int y = 0; y < 256; y += 2) { + for (int x = 0; x < 256; x += 2) { + texture[(x + y * 256) * 4 + 0] = 255; + texture[(x + y * 256) * 4 + 1] = 255; + texture[(x + y * 256) * 4 + 2] = 255; + texture[(x + y * 256) * 4 + 3] = 255; + } + } +*/ + mytex->Generate(); + + mogltk::glbase::Enter2DMode(); + + mytex->Bind(); + glBegin(GL_TRIANGLE_STRIP); + glTexCoord2i(0, 0); + glVertex2f(50, 50); + glTexCoord2i(511, 0); + glVertex2f(561, 50); + glTexCoord2i(0, 511); + glVertex2f(50, 561); + glTexCoord2i(511, 511); + glVertex2f(561, 561); + glEnd(); + + mogltk::texture::Unbind(); + glBegin(GL_TRIANGLE_STRIP); +// glTexCoord2i(0, 0); + glColor3d(0, 0, 0); + glVertex2i(400, 100); +// glTexCoord2i(256, 0); + glColor3d(1, 0, 0); + glVertex2i(450, 100); +// glTexCoord2i(0, 256); + glColor3d(0, 1, 0); + glVertex2i(400, 150); +// glTexCoord2i(256, 256); + glColor3d(0, 0, 1); + glVertex2i(450, 150); + glEnd(); + mogltk::glbase::Leave2DMode(); + + mogltk::glbase::Flip(); + +// sleep(15); + getchar(); + + delete mytex; + + return 0; +} +CODE_ENDS -- cgit v1.2.3