GLuint _gk_load_texture( const GLYPH_GL_PIXELTYPE *pixeldata, int w, int h )
{
   GLuint textureId;
   
#if (GLYPH_TARGET == GLYPH_TARGET_ALLEGGL)

   BITMAP *temp;
   int i;
   
   /* Unfortunately, we currenly need to make a copy of the pixel data */
   
   temp = create_bitmap_ex( 8, w, h );
   
   for( i = 0; i < w*h; i++ )
      putpixel( temp, i%w, i/w, pixeldata[i] );
   
   allegro_gl_use_alpha_channel( TRUE );
   allegro_gl_use_mipmapping(FALSE);
   allegro_gl_set_texture_format( GL_ALPHA8 );
   
   textureId = allegro_gl_make_texture_ex( AGL_TEXTURE_ALPHA_ONLY, temp, GL_ALPHA8 );
   
   destroy_bitmap( temp );

#else

   glGenTextures( 1, &textureId );
   glBindTexture( GL_TEXTURE_2D, textureId );
   glTexImage2D( GL_TEXTURE_2D, 0, 1, w, h, 0, GL_ALPHA8, GL_UNSIGNED_BYTE, pixeldata );
   
#endif
   
   return textureId;
}
Example #2
0
 void Animator::getTexture()
 {
     GUIOBJ *render = pArea->get_object("animator.render");
     if (render == NULL)     // Nothing to render to
     {
         texture = 0;
         return;
     }
     render->u1 = 0.0f;  render->v1 = 1.0f;
     render->u2 = 1.0f;  render->v2 = 0.0f;
     int w = (int)(render->x2 - render->x1);
     int h = (int)(render->y2 - render->y1);
     if ((GLuint)render->Data == 0)
     {
         allegro_gl_set_texture_format(GL_RGB8);
         render->Data = (uint32) gfx->create_texture( w, h, FILTER_LINEAR );
     }
     texture = render->Data;
 }
Example #3
0
void showIntro(void)
{
	allegro_gl_begin();
	glMatrixMode(GL_PROJECTION);
	glPushMatrix();
	glLoadIdentity();
	glOrtho(0, 800, 0, 600, -1, 1);
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
	glClearColor(0, 0, 0, 0);
	glShadeModel(GL_SMOOTH);
	glDepthFunc(GL_LEQUAL);
	glClearDepth(1.0);
	glEnable(GL_DEPTH_TEST);
	glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
	glEnable(GL_TEXTURE_2D);
	allegro_gl_end();

	GLuint machineballtex;
	allegro_gl_set_texture_format(GL_RGBA);
	BITMAP *bmp = create_bitmap_ex(32, 256, 64);
	blit(&mb_machineball_bmp, bmp, 0, 0, 0, 0, 256, 64);
	machineballtex = allegro_gl_make_masked_texture(bmp);
	destroy_bitmap(bmp);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

	dp = al_start_duh(menuduh, 2, 0, (float)options.musicvol/255.0, 2048, 22050);
	menumusicisplaying=1;

	timer.install();
	double time;
	time=0;
	while(!(key[KEY_ESC] || time>23))
	{
		rest(1);
		time=timer.seconds();

		al_poll_duh(dp);

		allegro_gl_begin();
		
		glLoadIdentity();
		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

		if(time<4)
		{
			glColor3f(time/4, time/4, time/4);
			text.print(120, 280, "BENNY KRAMEK PRESENTS");
			glBindTexture(GL_TEXTURE_2D, bennykramekwebtex);
			glBegin(GL_QUADS);
			glTexCoord2f(0, 0);
			glVertex2i(242, 180);
			glTexCoord2f(1, 0);
			glVertex2i(498, 180);
			glTexCoord2f(1, 1);
			glVertex2i(498, 212);
			glTexCoord2f(0, 1);
			glVertex2i(242, 212);
			glEnd();
		}
		else if(time<8)
		{
			glColor3f(1-((time-4)/4), 1-((time-4)/4), 1-((time-4)/4));
			text.print(120, 280, "BENNY KRAMEK PRESENTS");
			glBindTexture(GL_TEXTURE_2D, bennykramekwebtex);
			glBegin(GL_QUADS);
			glTexCoord2f(0, 0);
			glVertex2i(242, 180);
			glTexCoord2f(1, 0);
			glVertex2i(498, 180);
			glTexCoord2f(1, 1);
			glVertex2i(498, 212);
			glTexCoord2f(0, 1);
			glVertex2i(242, 212);
			glEnd();
		}

		glColor3f(0.5, 0.5, 0.5);
		text.begin();
		text.print(20, (int)(60*(time-8.7)),     "THIS IS THE FUTURE.");
		text.print(20, (int)(60*(time-8.7))-50,  "A FUTURE WHERE PRIMITIVE SPORTS");
		text.print(20, (int)(60*(time-8.7))-100, "NO LONGER EXIST. IN THIS WORLD,");
		text.print(20, (int)(60*(time-8.7))-150, "THERE IS ONLY ONE SPORT.");
		text.print(20, (int)(60*(time-8.7))-200, "THERE IS ONLY...");
		text.end();

		if(time>22 && time<=22.5)
		{
			glColor3f(1, 1, 1);
			glBindTexture(GL_TEXTURE_2D, machineballtex);
			glTranslatef(400, 300, 0);
			glScalef((time-22)*200, (time-22)*200, (time-22)*200);
			glBegin(GL_QUADS);
			glTexCoord2f(0, 0);
			glVertex2i(-4, -1);
			glTexCoord2f(1, 0);
			glVertex2i(4, -1);
			glTexCoord2f(1, 1);
			glVertex2i(4, 1);
			glTexCoord2f(0, 1);
			glVertex2i(-4, 1);
			glEnd();

		}
		if(time>22.5)
		{
			glColor3f(1, 1, 1);
			glBindTexture(GL_TEXTURE_2D, machineballtex);
			glTranslatef(400, 300+(time-22.5)*240, 0);
			glScalef(100-(time-22.5)*50, 100-(time-22.5)*50, 100-(time-22.5)*50);
			glBegin(GL_QUADS);
			glTexCoord2f(0, 0);
			glVertex2i(-4, -1);
			glTexCoord2f(1, 0);
			glVertex2i(4, -1);
			glTexCoord2f(1, 1);
			glVertex2i(4, 1);
			glTexCoord2f(0, 1);
			glVertex2i(-4, 1);
			glEnd();
			glColor4f(1, 1, 1, 1-((time-22.5)));
			glLoadIdentity();
			glDisable(GL_TEXTURE_2D);
			glBegin(GL_QUADS);
			glVertex2i(0, 0);
			glVertex2i(800, 0);
			glVertex2i(800, 600);
			glVertex2i(0, 600);
			glEnd();
			glEnable(GL_TEXTURE_2D);
		}
		
		glFlush();
		allegro_gl_flip();
		allegro_gl_end();
	}

	glDeleteTextures(1, &machineballtex);
}