[SDL] Blank screen on android

image28 image28 at slingshot.co.nz
Tue Mar 12 15:47:05 PDT 2013


draw ----
	float height=(float)h/(float)tempH;
	float width=(float)w/(float)tempW;

	glBindTexture( GL_TEXTURE_2D, *(texture+entity) );

    const GLfloat t[8] = { 0.0, 0.0, width,   0.0, width,   height,   0.0, height };
    const GLshort v[8] = { x,   y,   x+w,     y,   x+w,     y+h,      x,   y+h };

    glVertexPointer( 2, GL_SHORT, 0, v );
    glEnableClientState( GL_VERTEX_ARRAY );

    glTexCoordPointer( 2, GL_FLOAT, 0, t );
    glEnableClientState( GL_TEXTURE_COORD_ARRAY );

    glDrawArrays( GL_TRIANGLE_FAN, 0, 4 );

texture----

tempW[0]=pow2(*(w+d));
		tempH[0]=pow2(*(h+d));
		
		*(w2)=0;
		*(h2)=0;
		*(w2)=tempW[0];
		*(h2)=tempH[0];
	

	for(d=0;d<*(texcount);d++)
	{
		if ( tempSurf->format->BytesPerPixel == 3 )
		{

		surface[d] = SDL_CreateRGBSurface(
				SDL_SWSURFACE,
				tempW[d], tempH[d],
				24,
		#if SDL_BYTEORDER == SDL_LIL_ENDIAN /* OpenGL RGBA masks */
					0x000000FF, 
					0x0000FF00, 
					0x00FF0000, 
					0xFF000000
		#else
					0xFF000000,
					0x00FF0000, 
					0x0000FF00, 
					0x000000FF
		#endif
			       );
		}else{
			surface[d] = SDL_CreateRGBSurface(
					SDL_SWSURFACE,
					tempW[d], tempH[d],
					32,
		#if SDL_BYTEORDER == SDL_LIL_ENDIAN /* OpenGL RGBA masks */
					0x000000FF, 
					0x0000FF00, 
					0x00FF0000, 
					0xFF000000
		#else
					0xFF000000,
					0x00FF0000, 
					0x0000FF00, 
					0x000000FF
		#endif
				       );
		}
		SDL_SetSurfaceBlendMode(tempSurf, SDL_BLENDMODE_NONE); 
		SDL_GetSurfaceAlphaMod(tempSurf,&saved_alpha);
		SDL_SetSurfaceAlphaMod(tempSurf,255);
		SDL_BlitSurface(tempSurf, NULL, surface[0], NULL);
		SDL_SetSurfaceAlphaMod(tempSurf,saved_alpha);
	}

	// Genorate and bind textures in list
	glGenTextures(*(texcount), texture);
	for(d=0;d<*(texcount);d++)
	{
		glBindTexture(GL_TEXTURE_2D, *(texture+d));
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
		if ( surface[d]->format->BytesPerPixel == 3 )
		{
			glTexImage2D(GL_TEXTURE_2D,0,GL_RGB,tempW[d],tempH[d],0,GL_RGB,GL_UNSIGNED_BYTE,surface[d]->pixels);
		}else{
			glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA,tempW[d],tempH[d],0,GL_RGBA,GL_UNSIGNED_BYTE,surface[d]->pixels);
		}
		
	}




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20130312/c112eb29/attachment-0009.htm>


More information about the SDL mailing list