Adding texEnv emulation to Immediate mode.
This commit is contained in:
Родитель
6346adec3b
Коммит
6210052164
1436
src/library_gl.js
1436
src/library_gl.js
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -64,7 +64,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
const char *exts = (const char *)glGetString(GL_EXTENSIONS);
|
||||
assert(hasext(exts, "GL_EXT_texture_filter_anisotropic"));
|
||||
|
||||
|
||||
GLint aniso;
|
||||
glGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &aniso);
|
||||
printf("Max anisotropy: %d (using that)\n", aniso);
|
||||
|
@ -73,10 +73,8 @@ int main(int argc, char *argv[])
|
|||
// Set the OpenGL state after creating the context with SDL_SetVideoMode
|
||||
|
||||
glClearColor( 0, 0, 0, 0 );
|
||||
|
||||
#if !EMSCRIPTEN
|
||||
glEnable( GL_TEXTURE_2D ); // Need this to display a texture XXX unnecessary in OpenGL ES 2.0/WebGL
|
||||
#endif
|
||||
|
||||
glEnable( GL_TEXTURE_2D ); // Needed when we're using the fixed-function pipeline.
|
||||
|
||||
glViewport( 0, 0, 600, 600 );
|
||||
|
||||
|
@ -155,7 +153,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
// Clear the screen before drawing
|
||||
glClear( GL_COLOR_BUFFER_BIT );
|
||||
|
||||
|
||||
// Bind the texture to which subsequent calls refer to
|
||||
int w = 10;
|
||||
int n = 15;
|
||||
|
@ -200,7 +198,7 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
*/
|
||||
SDL_GL_SwapBuffers();
|
||||
|
||||
|
||||
#if !EMSCRIPTEN
|
||||
// Wait for 3 seconds to give us a chance to see the image
|
||||
SDL_Delay(2000);
|
||||
|
@ -208,8 +206,8 @@ int main(int argc, char *argv[])
|
|||
|
||||
// Now we can delete the OpenGL texture and close down SDL
|
||||
glDeleteTextures( 1, &texture );
|
||||
|
||||
|
||||
SDL_Quit();
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -115,11 +115,11 @@ int main(int argc, char *argv[])
|
|||
printf("Unable to set video mode: %s\n", SDL_GetError());
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
// Set the OpenGL state after creating the context with SDL_SetVideoMode
|
||||
|
||||
glClearColor( 0, 0, 0, 0 );
|
||||
|
||||
|
||||
#if !EMSCRIPTEN
|
||||
glEnable( GL_TEXTURE_2D ); // Need this to display a texture XXX unnecessary in OpenGL ES 2.0/WebGL
|
||||
#endif
|
||||
|
@ -135,30 +135,30 @@ int main(int argc, char *argv[])
|
|||
|
||||
glMatrixMode( GL_MODELVIEW );
|
||||
glLoadIdentity();
|
||||
|
||||
|
||||
// Load the OpenGL texture
|
||||
|
||||
GLuint texture; // Texture object handle
|
||||
SDL_Surface *surface; // Gives us the information to make the texture
|
||||
|
||||
if ( (surface = IMG_Load("screenshot.png")) ) {
|
||||
|
||||
|
||||
if ( (surface = IMG_Load("screenshot.png")) ) {
|
||||
|
||||
// Check that the image's width is a power of 2
|
||||
if ( (surface->w & (surface->w - 1)) != 0 ) {
|
||||
printf("warning: image.bmp's width is not a power of 2\n");
|
||||
}
|
||||
|
||||
|
||||
// Also check if the height is a power of 2
|
||||
if ( (surface->h & (surface->h - 1)) != 0 ) {
|
||||
printf("warning: image.bmp's height is not a power of 2\n");
|
||||
}
|
||||
|
||||
|
||||
// Have OpenGL generate a texture object handle for us
|
||||
glGenTextures( 1, &texture );
|
||||
|
||||
|
||||
// Bind the texture object
|
||||
glBindTexture( GL_TEXTURE_2D, texture );
|
||||
|
||||
|
||||
// Set the texture's stretching properties
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
|
||||
|
@ -169,25 +169,25 @@ int main(int argc, char *argv[])
|
|||
memset(surface->pixels, 0x66, surface->w*surface->h);
|
||||
|
||||
// Edit the texture object's image data using the information SDL_Surface gives us
|
||||
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, surface->w, surface->h, 0,
|
||||
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, surface->w, surface->h, 0,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, surface->pixels );
|
||||
|
||||
//SDL_UnlockSurface(surface);
|
||||
}
|
||||
}
|
||||
else {
|
||||
printf("SDL could not load image.bmp: %s\n", SDL_GetError());
|
||||
SDL_Quit();
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Free the SDL_Surface only if it was successfully created
|
||||
if ( surface ) {
|
||||
if ( surface ) {
|
||||
SDL_FreeSurface( surface );
|
||||
}
|
||||
|
||||
|
||||
// Clear the screen before drawing
|
||||
glClear( GL_COLOR_BUFFER_BIT );
|
||||
|
||||
|
||||
shaders();
|
||||
|
||||
// Bind the texture to which subsequent calls refer to
|
||||
|
@ -218,7 +218,7 @@ int main(int argc, char *argv[])
|
|||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
|
||||
SDL_GL_SwapBuffers();
|
||||
|
||||
|
||||
#if !EMSCRIPTEN
|
||||
// Wait for 3 seconds to give us a chance to see the image
|
||||
SDL_Delay(3000);
|
||||
|
@ -226,8 +226,8 @@ int main(int argc, char *argv[])
|
|||
|
||||
// Now we can delete the OpenGL texture and close down SDL
|
||||
glDeleteTextures( 1, &texture );
|
||||
|
||||
|
||||
SDL_Quit();
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -99,11 +99,11 @@ int main(int argc, char *argv[])
|
|||
printf("Unable to set video mode: %s\n", SDL_GetError());
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
// Set the OpenGL state after creating the context with SDL_SetVideoMode
|
||||
|
||||
glClearColor( 0, 0, 0, 0 );
|
||||
|
||||
|
||||
#if !EMSCRIPTEN
|
||||
glEnable( GL_TEXTURE_2D ); // Need this to display a texture XXX unnecessary in OpenGL ES 2.0/WebGL
|
||||
#endif
|
||||
|
@ -119,30 +119,30 @@ int main(int argc, char *argv[])
|
|||
|
||||
glMatrixMode( GL_MODELVIEW );
|
||||
glLoadIdentity();
|
||||
|
||||
|
||||
// Load the OpenGL texture
|
||||
|
||||
GLuint texture; // Texture object handle
|
||||
SDL_Surface *surface; // Gives us the information to make the texture
|
||||
|
||||
if ( (surface = IMG_Load("screenshot.png")) ) {
|
||||
|
||||
|
||||
if ( (surface = IMG_Load("screenshot.png")) ) {
|
||||
|
||||
// Check that the image's width is a power of 2
|
||||
if ( (surface->w & (surface->w - 1)) != 0 ) {
|
||||
printf("warning: image.bmp's width is not a power of 2\n");
|
||||
}
|
||||
|
||||
|
||||
// Also check if the height is a power of 2
|
||||
if ( (surface->h & (surface->h - 1)) != 0 ) {
|
||||
printf("warning: image.bmp's height is not a power of 2\n");
|
||||
}
|
||||
|
||||
|
||||
// Have OpenGL generate a texture object handle for us
|
||||
glGenTextures( 1, &texture );
|
||||
|
||||
|
||||
// Bind the texture object
|
||||
glBindTexture( GL_TEXTURE_2D, texture );
|
||||
|
||||
|
||||
// Set the texture's stretching properties
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
|
||||
|
@ -153,25 +153,25 @@ int main(int argc, char *argv[])
|
|||
memset(surface->pixels, 0x66, surface->w*surface->h);
|
||||
|
||||
// Edit the texture object's image data using the information SDL_Surface gives us
|
||||
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, surface->w, surface->h, 0,
|
||||
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, surface->w, surface->h, 0,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, surface->pixels );
|
||||
|
||||
//SDL_UnlockSurface(surface);
|
||||
}
|
||||
}
|
||||
else {
|
||||
printf("SDL could not load image.bmp: %s\n", SDL_GetError());
|
||||
SDL_Quit();
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Free the SDL_Surface only if it was successfully created
|
||||
if ( surface ) {
|
||||
if ( surface ) {
|
||||
SDL_FreeSurface( surface );
|
||||
}
|
||||
|
||||
|
||||
// Clear the screen before drawing
|
||||
glClear( GL_COLOR_BUFFER_BIT );
|
||||
|
||||
|
||||
shaders();
|
||||
|
||||
// Bind the texture to which subsequent calls refer to
|
||||
|
@ -204,7 +204,7 @@ int main(int argc, char *argv[])
|
|||
1, 1,
|
||||
0, 1, };
|
||||
|
||||
glEnableClientState(GL_TEXTURE_2D); // XXX should be GL_TEXTURE_COORD_ARRAY); // XXX
|
||||
glEnableClientState(GL_TEXTURE_2D); // XXX should be GL_TEXTURE_COORD_ARRAY); // XXX
|
||||
glTexCoordPointer(2, GL_FLOAT, 0, textureData);
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glVertexPointer(2, GL_FLOAT, 0, vertexData);
|
||||
|
@ -215,7 +215,7 @@ int main(int argc, char *argv[])
|
|||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
|
||||
SDL_GL_SwapBuffers();
|
||||
|
||||
|
||||
#if !EMSCRIPTEN
|
||||
// Wait for 3 seconds to give us a chance to see the image
|
||||
SDL_Delay(3000);
|
||||
|
@ -223,8 +223,8 @@ int main(int argc, char *argv[])
|
|||
|
||||
// Now we can delete the OpenGL texture and close down SDL
|
||||
glDeleteTextures( 1, &texture );
|
||||
|
||||
|
||||
SDL_Quit();
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -99,11 +99,11 @@ int main(int argc, char *argv[])
|
|||
printf("Unable to set video mode: %s\n", SDL_GetError());
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
// Set the OpenGL state after creating the context with SDL_SetVideoMode
|
||||
|
||||
glClearColor( 0, 0, 0, 0 );
|
||||
|
||||
|
||||
#if !EMSCRIPTEN
|
||||
glEnable( GL_TEXTURE_2D ); // Need this to display a texture XXX unnecessary in OpenGL ES 2.0/WebGL
|
||||
#endif
|
||||
|
@ -119,30 +119,30 @@ int main(int argc, char *argv[])
|
|||
|
||||
glMatrixMode( GL_MODELVIEW );
|
||||
glLoadIdentity();
|
||||
|
||||
|
||||
// Load the OpenGL texture
|
||||
|
||||
GLuint texture; // Texture object handle
|
||||
SDL_Surface *surface; // Gives us the information to make the texture
|
||||
|
||||
if ( (surface = IMG_Load("screenshot.png")) ) {
|
||||
|
||||
|
||||
if ( (surface = IMG_Load("screenshot.png")) ) {
|
||||
|
||||
// Check that the image's width is a power of 2
|
||||
if ( (surface->w & (surface->w - 1)) != 0 ) {
|
||||
printf("warning: image.bmp's width is not a power of 2\n");
|
||||
}
|
||||
|
||||
|
||||
// Also check if the height is a power of 2
|
||||
if ( (surface->h & (surface->h - 1)) != 0 ) {
|
||||
printf("warning: image.bmp's height is not a power of 2\n");
|
||||
}
|
||||
|
||||
|
||||
// Have OpenGL generate a texture object handle for us
|
||||
glGenTextures( 1, &texture );
|
||||
|
||||
|
||||
// Bind the texture object
|
||||
glBindTexture( GL_TEXTURE_2D, texture );
|
||||
|
||||
|
||||
// Set the texture's stretching properties
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
|
||||
|
@ -153,25 +153,25 @@ int main(int argc, char *argv[])
|
|||
memset(surface->pixels, 0x66, surface->w*surface->h);
|
||||
|
||||
// Edit the texture object's image data using the information SDL_Surface gives us
|
||||
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, surface->w, surface->h, 0,
|
||||
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, surface->w, surface->h, 0,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, surface->pixels );
|
||||
|
||||
//SDL_UnlockSurface(surface);
|
||||
}
|
||||
}
|
||||
else {
|
||||
printf("SDL could not load image.bmp: %s\n", SDL_GetError());
|
||||
SDL_Quit();
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Free the SDL_Surface only if it was successfully created
|
||||
if ( surface ) {
|
||||
if ( surface ) {
|
||||
SDL_FreeSurface( surface );
|
||||
}
|
||||
|
||||
|
||||
// Clear the screen before drawing
|
||||
glClear( GL_COLOR_BUFFER_BIT );
|
||||
|
||||
|
||||
shaders();
|
||||
|
||||
// Bind the texture to which subsequent calls refer to
|
||||
|
@ -215,7 +215,7 @@ int main(int argc, char *argv[])
|
|||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
|
||||
SDL_GL_SwapBuffers();
|
||||
|
||||
|
||||
#if !EMSCRIPTEN
|
||||
// Wait for 3 seconds to give us a chance to see the image
|
||||
SDL_Delay(3000);
|
||||
|
@ -223,8 +223,8 @@ int main(int argc, char *argv[])
|
|||
|
||||
// Now we can delete the OpenGL texture and close down SDL
|
||||
glDeleteTextures( 1, &texture );
|
||||
|
||||
|
||||
SDL_Quit();
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -46,14 +46,12 @@ int main(int argc, char *argv[])
|
|||
printf("Unable to set video mode: %s\n", SDL_GetError());
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
// Set the OpenGL state after creating the context with SDL_SetVideoMode
|
||||
|
||||
glClearColor( 0, 0, 0, 0 );
|
||||
|
||||
#if !EMSCRIPTEN
|
||||
glEnable( GL_TEXTURE_2D ); // Need this to display a texture XXX unnecessary in OpenGL ES 2.0/WebGL
|
||||
#endif
|
||||
|
||||
glEnable( GL_TEXTURE_2D ); // Needed when we're using the fixed-function pipeline.
|
||||
|
||||
glViewport( 0, 0, 640, 480 );
|
||||
|
||||
|
@ -66,30 +64,30 @@ int main(int argc, char *argv[])
|
|||
|
||||
glMatrixMode( GL_MODELVIEW );
|
||||
glLoadIdentity();
|
||||
|
||||
|
||||
// Load the OpenGL texture
|
||||
|
||||
GLuint texture; // Texture object handle
|
||||
SDL_Surface *surface; // Gives us the information to make the texture
|
||||
|
||||
if ( (surface = IMG_Load("screenshot.png")) ) {
|
||||
|
||||
|
||||
if ( (surface = IMG_Load("screenshot.png")) ) {
|
||||
|
||||
// Check that the image's width is a power of 2
|
||||
if ( (surface->w & (surface->w - 1)) != 0 ) {
|
||||
printf("warning: image.bmp's width is not a power of 2\n");
|
||||
}
|
||||
|
||||
|
||||
// Also check if the height is a power of 2
|
||||
if ( (surface->h & (surface->h - 1)) != 0 ) {
|
||||
printf("warning: image.bmp's height is not a power of 2\n");
|
||||
}
|
||||
|
||||
|
||||
// Have OpenGL generate a texture object handle for us
|
||||
glGenTextures( 1, &texture );
|
||||
|
||||
|
||||
// Bind the texture object
|
||||
glBindTexture( GL_TEXTURE_2D, texture );
|
||||
|
||||
|
||||
// Set the texture's stretching properties
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
|
||||
|
@ -100,25 +98,25 @@ int main(int argc, char *argv[])
|
|||
memset(surface->pixels, 0x66, surface->w*surface->h);
|
||||
|
||||
// Edit the texture object's image data using the information SDL_Surface gives us
|
||||
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, surface->w, surface->h, 0,
|
||||
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, surface->w, surface->h, 0,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, surface->pixels );
|
||||
|
||||
//SDL_UnlockSurface(surface);
|
||||
}
|
||||
}
|
||||
else {
|
||||
printf("SDL could not load image.bmp: %s\n", SDL_GetError());
|
||||
SDL_Quit();
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Free the SDL_Surface only if it was successfully created
|
||||
if ( surface ) {
|
||||
if ( surface ) {
|
||||
SDL_FreeSurface( surface );
|
||||
}
|
||||
|
||||
|
||||
// Clear the screen before drawing
|
||||
glClear( GL_COLOR_BUFFER_BIT );
|
||||
|
||||
|
||||
// Bind the texture to which subsequent calls refer to
|
||||
glBindTexture( GL_TEXTURE_2D, texture );
|
||||
|
||||
|
@ -151,7 +149,7 @@ int main(int argc, char *argv[])
|
|||
glEnd();
|
||||
|
||||
SDL_GL_SwapBuffers();
|
||||
|
||||
|
||||
#if !EMSCRIPTEN
|
||||
// Wait for 3 seconds to give us a chance to see the image
|
||||
SDL_Delay(3000);
|
||||
|
@ -159,8 +157,8 @@ int main(int argc, char *argv[])
|
|||
|
||||
// Now we can delete the OpenGL texture and close down SDL
|
||||
glDeleteTextures( 1, &texture );
|
||||
|
||||
|
||||
SDL_Quit();
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
16
tests/s3tc.c
16
tests/s3tc.c
|
@ -63,14 +63,12 @@ int main(int argc, char *argv[])
|
|||
const char *exts = (const char *)glGetString(GL_EXTENSIONS);
|
||||
assert(hasext(exts, "GL_ARB_texture_compression"));
|
||||
assert(hasext(exts, "GL_EXT_texture_compression_s3tc"));
|
||||
|
||||
|
||||
// Set the OpenGL state after creating the context with SDL_SetVideoMode
|
||||
|
||||
glClearColor( 0, 0, 0, 0 );
|
||||
|
||||
#if !EMSCRIPTEN
|
||||
glEnable( GL_TEXTURE_2D ); // Need this to display a texture XXX unnecessary in OpenGL ES 2.0/WebGL
|
||||
#endif
|
||||
|
||||
glEnable( GL_TEXTURE_2D ); // Needed when we're using the fixed-function pipeline.
|
||||
|
||||
glViewport( 0, 0, 640, 480 );
|
||||
|
||||
|
@ -110,7 +108,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
// Clear the screen before drawing
|
||||
glClear( GL_COLOR_BUFFER_BIT );
|
||||
|
||||
|
||||
// Bind the texture to which subsequent calls refer to
|
||||
glBindTexture( GL_TEXTURE_2D, texture );
|
||||
|
||||
|
@ -143,7 +141,7 @@ int main(int argc, char *argv[])
|
|||
glEnd();
|
||||
|
||||
SDL_GL_SwapBuffers();
|
||||
|
||||
|
||||
#if !EMSCRIPTEN
|
||||
// Wait for 3 seconds to give us a chance to see the image
|
||||
SDL_Delay(1500);
|
||||
|
@ -151,8 +149,8 @@ int main(int argc, char *argv[])
|
|||
|
||||
// Now we can delete the OpenGL texture and close down SDL
|
||||
glDeleteTextures( 1, &texture );
|
||||
|
||||
|
||||
SDL_Quit();
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -63,14 +63,12 @@ int main(int argc, char *argv[])
|
|||
const char *exts = (const char *)glGetString(GL_EXTENSIONS);
|
||||
assert(hasext(exts, "GL_ARB_texture_compression"));
|
||||
assert(hasext(exts, "GL_EXT_texture_compression_s3tc"));
|
||||
|
||||
|
||||
// Set the OpenGL state after creating the context with SDL_SetVideoMode
|
||||
|
||||
glClearColor( 0, 0, 0, 0 );
|
||||
|
||||
#if !EMSCRIPTEN
|
||||
glEnable( GL_TEXTURE_2D ); // Need this to display a texture XXX unnecessary in OpenGL ES 2.0/WebGL
|
||||
#endif
|
||||
|
||||
glEnable( GL_TEXTURE_2D ); // Needed when we're using the fixed-function pipeline.
|
||||
|
||||
glViewport( 0, 0, 640, 480 );
|
||||
|
||||
|
@ -158,7 +156,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
// Clear the screen before drawing
|
||||
glClear( GL_COLOR_BUFFER_BIT );
|
||||
|
||||
|
||||
// Bind the texture to which subsequent calls refer to
|
||||
glBindTexture( GL_TEXTURE_2D, texture );
|
||||
|
||||
|
@ -195,7 +193,7 @@ int main(int argc, char *argv[])
|
|||
glEnd();
|
||||
|
||||
SDL_GL_SwapBuffers();
|
||||
|
||||
|
||||
#if !EMSCRIPTEN
|
||||
// Wait for 3 seconds to give us a chance to see the image
|
||||
SDL_Delay(1500);
|
||||
|
@ -203,8 +201,8 @@ int main(int argc, char *argv[])
|
|||
|
||||
// Now we can delete the OpenGL texture and close down SDL
|
||||
glDeleteTextures( 1, &texture );
|
||||
|
||||
|
||||
SDL_Quit();
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -47,14 +47,12 @@ int main(int argc, char *argv[])
|
|||
printf("Unable to set video mode: %s\n", SDL_GetError());
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
// Set the OpenGL state after creating the context with SDL_SetVideoMode
|
||||
|
||||
glClearColor( 0, 0, 0, 0 );
|
||||
|
||||
#if !EMSCRIPTEN
|
||||
glEnable( GL_TEXTURE_2D ); // Need this to display a texture XXX unnecessary in OpenGL ES 2.0/WebGL
|
||||
#endif
|
||||
|
||||
glEnable( GL_TEXTURE_2D ); // Needed when we're using the fixed-function pipeline.
|
||||
|
||||
glViewport( 0, 0, 640, 480 );
|
||||
|
||||
|
@ -63,33 +61,33 @@ int main(int argc, char *argv[])
|
|||
glLoadIdentity();
|
||||
|
||||
glOrtho( 0, 640, 480, 0, -1000, 1000 );
|
||||
|
||||
|
||||
glMatrixMode( GL_MODELVIEW );
|
||||
glLoadIdentity();
|
||||
|
||||
|
||||
// Load the OpenGL texture
|
||||
|
||||
GLuint texture; // Texture object handle
|
||||
SDL_Surface *surface; // Gives us the information to make the texture
|
||||
|
||||
if ( (surface = IMG_Load("screenshot.png")) ) {
|
||||
|
||||
|
||||
if ( (surface = IMG_Load("screenshot.png")) ) {
|
||||
|
||||
// Check that the image's width is a power of 2
|
||||
if ( (surface->w & (surface->w - 1)) != 0 ) {
|
||||
printf("warning: image.bmp's width is not a power of 2\n");
|
||||
}
|
||||
|
||||
|
||||
// Also check if the height is a power of 2
|
||||
if ( (surface->h & (surface->h - 1)) != 0 ) {
|
||||
printf("warning: image.bmp's height is not a power of 2\n");
|
||||
}
|
||||
|
||||
|
||||
// Have OpenGL generate a texture object handle for us
|
||||
glGenTextures( 1, &texture );
|
||||
|
||||
|
||||
// Bind the texture object
|
||||
glBindTexture( GL_TEXTURE_2D, texture );
|
||||
|
||||
|
||||
// Set the texture's stretching properties
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
|
||||
|
@ -100,25 +98,25 @@ int main(int argc, char *argv[])
|
|||
memset(surface->pixels, 0x66, surface->w*surface->h);
|
||||
|
||||
// Edit the texture object's image data using the information SDL_Surface gives us
|
||||
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, surface->w, surface->h, 0,
|
||||
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, surface->w, surface->h, 0,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, surface->pixels );
|
||||
|
||||
//SDL_UnlockSurface(surface);
|
||||
}
|
||||
}
|
||||
else {
|
||||
printf("SDL could not load image.bmp: %s\n", SDL_GetError());
|
||||
SDL_Quit();
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Free the SDL_Surface only if it was successfully created
|
||||
if ( surface ) {
|
||||
if ( surface ) {
|
||||
SDL_FreeSurface( surface );
|
||||
}
|
||||
|
||||
|
||||
// Clear the screen before drawing
|
||||
glClear( GL_COLOR_BUFFER_BIT );
|
||||
|
||||
|
||||
// Bind the texture to which subsequent calls refer to
|
||||
glBindTexture( GL_TEXTURE_2D, texture );
|
||||
|
||||
|
@ -148,9 +146,7 @@ int main(int argc, char *argv[])
|
|||
glTexCoord2i( 0, 1 ); glVertex3f( 500, 410, 1 );
|
||||
glEnd();
|
||||
|
||||
#if !EMSCRIPTEN
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
#endif
|
||||
|
||||
glColor3ub(90, 255, 255);
|
||||
glBegin( GL_QUADS );
|
||||
|
@ -168,7 +164,7 @@ int main(int argc, char *argv[])
|
|||
glEnd();
|
||||
|
||||
SDL_GL_SwapBuffers();
|
||||
|
||||
|
||||
#if !EMSCRIPTEN
|
||||
// Wait for 3 seconds to give us a chance to see the image
|
||||
SDL_Delay(30000);
|
||||
|
@ -176,8 +172,8 @@ int main(int argc, char *argv[])
|
|||
|
||||
// Now we can delete the OpenGL texture and close down SDL
|
||||
glDeleteTextures( 1, &texture );
|
||||
|
||||
|
||||
SDL_Quit();
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -47,14 +47,12 @@ int main(int argc, char *argv[])
|
|||
printf("Unable to set video mode: %s\n", SDL_GetError());
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
// Set the OpenGL state after creating the context with SDL_SetVideoMode
|
||||
|
||||
glClearColor( 0, 0, 0, 0 );
|
||||
|
||||
#if !EMSCRIPTEN
|
||||
glEnable( GL_TEXTURE_2D ); // Need this to display a texture XXX unnecessary in OpenGL ES 2.0/WebGL
|
||||
#endif
|
||||
|
||||
glEnable( GL_TEXTURE_2D ); // Needed when we're using the fixed-function pipeline.
|
||||
|
||||
glViewport( 0, 0, 640, 480 );
|
||||
|
||||
|
@ -63,33 +61,33 @@ int main(int argc, char *argv[])
|
|||
glLoadIdentity();
|
||||
|
||||
glOrtho( 0, 640, 480, 0, -1000, 1000 );
|
||||
|
||||
|
||||
glMatrixMode( GL_MODELVIEW );
|
||||
glLoadIdentity();
|
||||
|
||||
|
||||
// Load the OpenGL texture
|
||||
|
||||
GLuint texture; // Texture object handle
|
||||
SDL_Surface *surface; // Gives us the information to make the texture
|
||||
|
||||
if ( (surface = IMG_Load("screenshot.png")) ) {
|
||||
|
||||
|
||||
if ( (surface = IMG_Load("screenshot.png")) ) {
|
||||
|
||||
// Check that the image's width is a power of 2
|
||||
if ( (surface->w & (surface->w - 1)) != 0 ) {
|
||||
printf("warning: image.bmp's width is not a power of 2\n");
|
||||
}
|
||||
|
||||
|
||||
// Also check if the height is a power of 2
|
||||
if ( (surface->h & (surface->h - 1)) != 0 ) {
|
||||
printf("warning: image.bmp's height is not a power of 2\n");
|
||||
}
|
||||
|
||||
|
||||
// Have OpenGL generate a texture object handle for us
|
||||
glGenTextures( 1, &texture );
|
||||
|
||||
|
||||
// Bind the texture object
|
||||
glBindTexture( GL_TEXTURE_2D, texture );
|
||||
|
||||
|
||||
// Set the texture's stretching properties
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
|
||||
|
@ -100,25 +98,25 @@ int main(int argc, char *argv[])
|
|||
memset(surface->pixels, 0x66, surface->w*surface->h);
|
||||
|
||||
// Edit the texture object's image data using the information SDL_Surface gives us
|
||||
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, surface->w, surface->h, 0,
|
||||
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, surface->w, surface->h, 0,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, surface->pixels );
|
||||
|
||||
//SDL_UnlockSurface(surface);
|
||||
}
|
||||
}
|
||||
else {
|
||||
printf("SDL could not load image.bmp: %s\n", SDL_GetError());
|
||||
SDL_Quit();
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Free the SDL_Surface only if it was successfully created
|
||||
if ( surface ) {
|
||||
if ( surface ) {
|
||||
SDL_FreeSurface( surface );
|
||||
}
|
||||
|
||||
|
||||
// Clear the screen before drawing
|
||||
glClear( GL_COLOR_BUFFER_BIT );
|
||||
|
||||
|
||||
// Bind the texture to which subsequent calls refer to
|
||||
glBindTexture( GL_TEXTURE_2D, texture );
|
||||
|
||||
|
@ -149,9 +147,7 @@ int main(int argc, char *argv[])
|
|||
glTexCoord2i( 0, 1 ); glVertex3f( 500, 410, 1 );
|
||||
glEnd();
|
||||
|
||||
#if !EMSCRIPTEN
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
#endif
|
||||
|
||||
glColor3ub(90, 255, 255);
|
||||
glBegin( GL_QUADS );
|
||||
|
@ -169,7 +165,7 @@ int main(int argc, char *argv[])
|
|||
glEnd();
|
||||
|
||||
SDL_GL_SwapBuffers();
|
||||
|
||||
|
||||
#if !EMSCRIPTEN
|
||||
// Wait for 3 seconds to give us a chance to see the image
|
||||
SDL_Delay(30000);
|
||||
|
@ -177,8 +173,8 @@ int main(int argc, char *argv[])
|
|||
|
||||
// Now we can delete the OpenGL texture and close down SDL
|
||||
glDeleteTextures( 1, &texture );
|
||||
|
||||
|
||||
SDL_Quit();
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -47,14 +47,12 @@ int main(int argc, char *argv[])
|
|||
printf("Unable to set video mode: %s\n", SDL_GetError());
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
// Set the OpenGL state after creating the context with SDL_SetVideoMode
|
||||
|
||||
glClearColor( 0, 0, 0, 0 );
|
||||
|
||||
#if !EMSCRIPTEN
|
||||
glEnable( GL_TEXTURE_2D ); // Need this to display a texture XXX unnecessary in OpenGL ES 2.0/WebGL
|
||||
#endif
|
||||
|
||||
glEnable( GL_TEXTURE_2D ); // Needed when we're using the fixed-function pipeline.
|
||||
|
||||
glViewport( 0, 0, 640, 480 );
|
||||
|
||||
|
@ -63,33 +61,33 @@ int main(int argc, char *argv[])
|
|||
glLoadIdentity();
|
||||
|
||||
glOrtho( 0, 640, 480, 0, -1000, 1000 );
|
||||
|
||||
|
||||
glMatrixMode( GL_MODELVIEW );
|
||||
glLoadIdentity();
|
||||
|
||||
|
||||
// Load the OpenGL texture
|
||||
|
||||
GLuint texture; // Texture object handle
|
||||
SDL_Surface *surface; // Gives us the information to make the texture
|
||||
|
||||
if ( (surface = IMG_Load("screenshot.png")) ) {
|
||||
|
||||
|
||||
if ( (surface = IMG_Load("screenshot.png")) ) {
|
||||
|
||||
// Check that the image's width is a power of 2
|
||||
if ( (surface->w & (surface->w - 1)) != 0 ) {
|
||||
printf("warning: image.bmp's width is not a power of 2\n");
|
||||
}
|
||||
|
||||
|
||||
// Also check if the height is a power of 2
|
||||
if ( (surface->h & (surface->h - 1)) != 0 ) {
|
||||
printf("warning: image.bmp's height is not a power of 2\n");
|
||||
}
|
||||
|
||||
|
||||
// Have OpenGL generate a texture object handle for us
|
||||
glGenTextures( 1, &texture );
|
||||
|
||||
|
||||
// Bind the texture object
|
||||
glBindTexture( GL_TEXTURE_2D, texture );
|
||||
|
||||
|
||||
// Set the texture's stretching properties
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
|
||||
|
@ -100,25 +98,25 @@ int main(int argc, char *argv[])
|
|||
memset(surface->pixels, 0x66, surface->w*surface->h);
|
||||
|
||||
// Edit the texture object's image data using the information SDL_Surface gives us
|
||||
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, surface->w, surface->h, 0,
|
||||
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, surface->w, surface->h, 0,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, surface->pixels );
|
||||
|
||||
//SDL_UnlockSurface(surface);
|
||||
}
|
||||
}
|
||||
else {
|
||||
printf("SDL could not load image.bmp: %s\n", SDL_GetError());
|
||||
SDL_Quit();
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Free the SDL_Surface only if it was successfully created
|
||||
if ( surface ) {
|
||||
if ( surface ) {
|
||||
SDL_FreeSurface( surface );
|
||||
}
|
||||
|
||||
|
||||
// Clear the screen before drawing
|
||||
glClear( GL_COLOR_BUFFER_BIT );
|
||||
|
||||
|
||||
// Bind the texture to which subsequent calls refer to
|
||||
glBindTexture( GL_TEXTURE_2D, texture );
|
||||
|
||||
|
@ -150,9 +148,7 @@ int main(int argc, char *argv[])
|
|||
glTexCoord2i( 0, 1 ); glVertex3f( 500, 410, 1 );
|
||||
glEnd();
|
||||
|
||||
#if !EMSCRIPTEN
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
#endif
|
||||
|
||||
glColor3ub(90, 255, 255);
|
||||
glBegin( GL_QUADS );
|
||||
|
@ -170,7 +166,7 @@ int main(int argc, char *argv[])
|
|||
glEnd();
|
||||
|
||||
SDL_GL_SwapBuffers();
|
||||
|
||||
|
||||
#if !EMSCRIPTEN
|
||||
// Wait for 3 seconds to give us a chance to see the image
|
||||
SDL_Delay(30000);
|
||||
|
@ -178,8 +174,8 @@ int main(int argc, char *argv[])
|
|||
|
||||
// Now we can delete the OpenGL texture and close down SDL
|
||||
glDeleteTextures( 1, &texture );
|
||||
|
||||
|
||||
SDL_Quit();
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -47,14 +47,12 @@ int main(int argc, char *argv[])
|
|||
printf("Unable to set video mode: %s\n", SDL_GetError());
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
// Set the OpenGL state after creating the context with SDL_SetVideoMode
|
||||
|
||||
glClearColor( 0, 0, 0, 0 );
|
||||
|
||||
#if !EMSCRIPTEN
|
||||
glEnable( GL_TEXTURE_2D ); // Need this to display a texture XXX unnecessary in OpenGL ES 2.0/WebGL
|
||||
#endif
|
||||
|
||||
glEnable( GL_TEXTURE_2D ); // Needed when we're using the fixed-function pipeline.
|
||||
|
||||
glViewport( 0, 0, 640, 480 );
|
||||
|
||||
|
@ -63,33 +61,33 @@ int main(int argc, char *argv[])
|
|||
glLoadIdentity();
|
||||
|
||||
glOrtho( 0, 640, 480, 0, -1000, 1000 );
|
||||
|
||||
|
||||
glMatrixMode( GL_MODELVIEW );
|
||||
glLoadIdentity();
|
||||
|
||||
|
||||
// Load the OpenGL texture
|
||||
|
||||
GLuint texture; // Texture object handle
|
||||
SDL_Surface *surface; // Gives us the information to make the texture
|
||||
|
||||
if ( (surface = IMG_Load("screenshot.png")) ) {
|
||||
|
||||
|
||||
if ( (surface = IMG_Load("screenshot.png")) ) {
|
||||
|
||||
// Check that the image's width is a power of 2
|
||||
if ( (surface->w & (surface->w - 1)) != 0 ) {
|
||||
printf("warning: image.bmp's width is not a power of 2\n");
|
||||
}
|
||||
|
||||
|
||||
// Also check if the height is a power of 2
|
||||
if ( (surface->h & (surface->h - 1)) != 0 ) {
|
||||
printf("warning: image.bmp's height is not a power of 2\n");
|
||||
}
|
||||
|
||||
|
||||
// Have OpenGL generate a texture object handle for us
|
||||
glGenTextures( 1, &texture );
|
||||
|
||||
|
||||
// Bind the texture object
|
||||
glBindTexture( GL_TEXTURE_2D, texture );
|
||||
|
||||
|
||||
// Set the texture's stretching properties
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
|
||||
|
@ -100,25 +98,25 @@ int main(int argc, char *argv[])
|
|||
memset(surface->pixels, 0x66, surface->w*surface->h);
|
||||
|
||||
// Edit the texture object's image data using the information SDL_Surface gives us
|
||||
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, surface->w, surface->h, 0,
|
||||
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, surface->w, surface->h, 0,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, surface->pixels );
|
||||
|
||||
//SDL_UnlockSurface(surface);
|
||||
}
|
||||
}
|
||||
else {
|
||||
printf("SDL could not load image.bmp: %s\n", SDL_GetError());
|
||||
SDL_Quit();
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Free the SDL_Surface only if it was successfully created
|
||||
if ( surface ) {
|
||||
if ( surface ) {
|
||||
SDL_FreeSurface( surface );
|
||||
}
|
||||
|
||||
|
||||
// Clear the screen before drawing
|
||||
glClear( GL_COLOR_BUFFER_BIT );
|
||||
|
||||
|
||||
// Bind the texture to which subsequent calls refer to
|
||||
glBindTexture( GL_TEXTURE_2D, texture );
|
||||
|
||||
|
@ -147,9 +145,7 @@ int main(int argc, char *argv[])
|
|||
glTexCoord2i( 0, 1 ); glVertex3f( 500, 410, -1 );
|
||||
glEnd();
|
||||
|
||||
#if !EMSCRIPTEN
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
#endif
|
||||
|
||||
glColor3ub(90, 255, 255);
|
||||
glBegin( GL_QUADS );
|
||||
|
@ -167,7 +163,7 @@ int main(int argc, char *argv[])
|
|||
glEnd();
|
||||
|
||||
SDL_GL_SwapBuffers();
|
||||
|
||||
|
||||
#if !EMSCRIPTEN
|
||||
// Wait for 3 seconds to give us a chance to see the image
|
||||
SDL_Delay(30000);
|
||||
|
@ -175,8 +171,8 @@ int main(int argc, char *argv[])
|
|||
|
||||
// Now we can delete the OpenGL texture and close down SDL
|
||||
glDeleteTextures( 1, &texture );
|
||||
|
||||
|
||||
SDL_Quit();
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -47,14 +47,10 @@ int main(int argc, char *argv[])
|
|||
printf("Unable to set video mode: %s\n", SDL_GetError());
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
// Set the OpenGL state after creating the context with SDL_SetVideoMode
|
||||
|
||||
glClearColor( 0, 0, 0, 0 );
|
||||
|
||||
#if !EMSCRIPTEN
|
||||
glEnable( GL_TEXTURE_2D ); // Need this to display a texture XXX unnecessary in OpenGL ES 2.0/WebGL
|
||||
#endif
|
||||
|
||||
glViewport( 0, 0, 640, 480 );
|
||||
|
||||
|
@ -63,33 +59,38 @@ int main(int argc, char *argv[])
|
|||
glLoadIdentity();
|
||||
|
||||
glOrtho( 0, 640, 480, 0, -1000, 1000 );
|
||||
|
||||
|
||||
glMatrixMode( GL_MODELVIEW );
|
||||
glLoadIdentity();
|
||||
|
||||
|
||||
// Delay Enable to after MatrixMode to assure we've activated
|
||||
// immediate mode. Otherwise, we don't properly record that
|
||||
// TEXTURE_2D is enabled for imm mode emulation.
|
||||
glEnable( GL_TEXTURE_2D ); // Needed when we're using the fixed-function pipeline.
|
||||
|
||||
// Load the OpenGL texture
|
||||
|
||||
GLuint texture; // Texture object handle
|
||||
SDL_Surface *surface; // Gives us the information to make the texture
|
||||
|
||||
if ( (surface = IMG_Load("screenshot.png")) ) {
|
||||
|
||||
|
||||
if ( (surface = IMG_Load("screenshot.png")) ) {
|
||||
|
||||
// Check that the image's width is a power of 2
|
||||
if ( (surface->w & (surface->w - 1)) != 0 ) {
|
||||
printf("warning: image.bmp's width is not a power of 2\n");
|
||||
}
|
||||
|
||||
|
||||
// Also check if the height is a power of 2
|
||||
if ( (surface->h & (surface->h - 1)) != 0 ) {
|
||||
printf("warning: image.bmp's height is not a power of 2\n");
|
||||
}
|
||||
|
||||
|
||||
// Have OpenGL generate a texture object handle for us
|
||||
glGenTextures( 1, &texture );
|
||||
|
||||
|
||||
// Bind the texture object
|
||||
glBindTexture( GL_TEXTURE_2D, texture );
|
||||
|
||||
|
||||
// Set the texture's stretching properties
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
|
||||
|
@ -100,25 +101,25 @@ int main(int argc, char *argv[])
|
|||
memset(surface->pixels, 0x66, surface->w*surface->h);
|
||||
|
||||
// Edit the texture object's image data using the information SDL_Surface gives us
|
||||
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, surface->w, surface->h, 0,
|
||||
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, surface->w, surface->h, 0,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, surface->pixels );
|
||||
|
||||
//SDL_UnlockSurface(surface);
|
||||
}
|
||||
}
|
||||
else {
|
||||
printf("SDL could not load image.bmp: %s\n", SDL_GetError());
|
||||
SDL_Quit();
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Free the SDL_Surface only if it was successfully created
|
||||
if ( surface ) {
|
||||
if ( surface ) {
|
||||
SDL_FreeSurface( surface );
|
||||
}
|
||||
|
||||
|
||||
// Clear the screen before drawing
|
||||
glClear( GL_COLOR_BUFFER_BIT );
|
||||
|
||||
|
||||
// Bind the texture to which subsequent calls refer to
|
||||
glBindTexture( GL_TEXTURE_2D, texture );
|
||||
|
||||
|
@ -147,9 +148,7 @@ int main(int argc, char *argv[])
|
|||
glTexCoord2i( 0, 1 ); glVertex3f( 500, 410, 1 );
|
||||
glEnd();
|
||||
|
||||
#if !EMSCRIPTEN
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
#endif
|
||||
|
||||
glColor3ub(90, 255, 255);
|
||||
glBegin( GL_QUADS );
|
||||
|
@ -167,7 +166,7 @@ int main(int argc, char *argv[])
|
|||
glEnd();
|
||||
|
||||
SDL_GL_SwapBuffers();
|
||||
|
||||
|
||||
#if !EMSCRIPTEN
|
||||
// Wait for 3 seconds to give us a chance to see the image
|
||||
SDL_Delay(30000);
|
||||
|
@ -175,8 +174,8 @@ int main(int argc, char *argv[])
|
|||
|
||||
// Now we can delete the OpenGL texture and close down SDL
|
||||
glDeleteTextures( 1, &texture );
|
||||
|
||||
|
||||
SDL_Quit();
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -46,14 +46,12 @@ int main(int argc, char *argv[])
|
|||
printf("Unable to set video mode: %s\n", SDL_GetError());
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
// Set the OpenGL state after creating the context with SDL_SetVideoMode
|
||||
|
||||
glClearColor( 0, 0, 0, 0 );
|
||||
|
||||
#if !EMSCRIPTEN
|
||||
glEnable( GL_TEXTURE_2D ); // Need this to display a texture XXX unnecessary in OpenGL ES 2.0/WebGL
|
||||
#endif
|
||||
|
||||
glEnable( GL_TEXTURE_2D ); // Needed when we're using the fixed-function pipeline.
|
||||
|
||||
glViewport( 0, 0, 640, 480 );
|
||||
|
||||
|
@ -62,33 +60,33 @@ int main(int argc, char *argv[])
|
|||
glLoadIdentity();
|
||||
|
||||
glOrtho( 0, 640, 480, 0, -1, 1 );
|
||||
|
||||
|
||||
glMatrixMode( GL_MODELVIEW );
|
||||
glLoadIdentity();
|
||||
|
||||
|
||||
// Load the OpenGL texture
|
||||
|
||||
GLuint texture; // Texture object handle
|
||||
SDL_Surface *surface; // Gives us the information to make the texture
|
||||
|
||||
if ( (surface = IMG_Load("screenshot.png")) ) {
|
||||
|
||||
|
||||
if ( (surface = IMG_Load("screenshot.png")) ) {
|
||||
|
||||
// Check that the image's width is a power of 2
|
||||
if ( (surface->w & (surface->w - 1)) != 0 ) {
|
||||
printf("warning: image.bmp's width is not a power of 2\n");
|
||||
}
|
||||
|
||||
|
||||
// Also check if the height is a power of 2
|
||||
if ( (surface->h & (surface->h - 1)) != 0 ) {
|
||||
printf("warning: image.bmp's height is not a power of 2\n");
|
||||
}
|
||||
|
||||
|
||||
// Have OpenGL generate a texture object handle for us
|
||||
glGenTextures( 1, &texture );
|
||||
|
||||
|
||||
// Bind the texture object
|
||||
glBindTexture( GL_TEXTURE_2D, texture );
|
||||
|
||||
|
||||
// Set the texture's stretching properties
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
|
||||
|
@ -99,25 +97,25 @@ int main(int argc, char *argv[])
|
|||
memset(surface->pixels, 0x66, surface->w*surface->h);
|
||||
|
||||
// Edit the texture object's image data using the information SDL_Surface gives us
|
||||
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, surface->w, surface->h, 0,
|
||||
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, surface->w, surface->h, 0,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, surface->pixels );
|
||||
|
||||
//SDL_UnlockSurface(surface);
|
||||
}
|
||||
}
|
||||
else {
|
||||
printf("SDL could not load image.bmp: %s\n", SDL_GetError());
|
||||
SDL_Quit();
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Free the SDL_Surface only if it was successfully created
|
||||
if ( surface ) {
|
||||
if ( surface ) {
|
||||
SDL_FreeSurface( surface );
|
||||
}
|
||||
|
||||
|
||||
// Clear the screen before drawing
|
||||
glClear( GL_COLOR_BUFFER_BIT );
|
||||
|
||||
|
||||
// Bind the texture to which subsequent calls refer to
|
||||
glBindTexture( GL_TEXTURE_2D, texture );
|
||||
|
||||
|
@ -140,9 +138,7 @@ int main(int argc, char *argv[])
|
|||
glTexCoord2i( 0, 1 ); glVertex3f( 500, 410, 0 );
|
||||
glEnd();
|
||||
|
||||
#if !EMSCRIPTEN
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
#endif
|
||||
|
||||
glColor3ub(90, 255, 255);
|
||||
glBegin( GL_QUADS );
|
||||
|
@ -160,7 +156,7 @@ int main(int argc, char *argv[])
|
|||
glEnd();
|
||||
|
||||
SDL_GL_SwapBuffers();
|
||||
|
||||
|
||||
#if !EMSCRIPTEN
|
||||
// Wait for 3 seconds to give us a chance to see the image
|
||||
SDL_Delay(3000);
|
||||
|
@ -168,8 +164,8 @@ int main(int argc, char *argv[])
|
|||
|
||||
// Now we can delete the OpenGL texture and close down SDL
|
||||
glDeleteTextures( 1, &texture );
|
||||
|
||||
|
||||
SDL_Quit();
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -46,14 +46,12 @@ int main(int argc, char *argv[])
|
|||
printf("Unable to set video mode: %s\n", SDL_GetError());
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
// Set the OpenGL state after creating the context with SDL_SetVideoMode
|
||||
|
||||
glClearColor( 0, 0, 0, 0 );
|
||||
|
||||
#if !EMSCRIPTEN
|
||||
glEnable( GL_TEXTURE_2D ); // Need this to display a texture XXX unnecessary in OpenGL ES 2.0/WebGL
|
||||
#endif
|
||||
|
||||
glEnable( GL_TEXTURE_2D ); // Needed when we're using the fixed-function pipeline.
|
||||
|
||||
glViewport( 0, 0, 640, 480 );
|
||||
|
||||
|
@ -66,30 +64,30 @@ int main(int argc, char *argv[])
|
|||
glLoadIdentity();
|
||||
|
||||
glOrtho( 0, 640, 480, 0, -1, 1 );
|
||||
|
||||
|
||||
// Load the OpenGL texture
|
||||
|
||||
GLuint texture; // Texture object handle
|
||||
SDL_Surface *surface; // Gives us the information to make the texture
|
||||
|
||||
if ( (surface = IMG_Load("screenshot.png")) ) {
|
||||
|
||||
|
||||
if ( (surface = IMG_Load("screenshot.png")) ) {
|
||||
|
||||
// Check that the image's width is a power of 2
|
||||
if ( (surface->w & (surface->w - 1)) != 0 ) {
|
||||
printf("warning: image.bmp's width is not a power of 2\n");
|
||||
}
|
||||
|
||||
|
||||
// Also check if the height is a power of 2
|
||||
if ( (surface->h & (surface->h - 1)) != 0 ) {
|
||||
printf("warning: image.bmp's height is not a power of 2\n");
|
||||
}
|
||||
|
||||
|
||||
// Have OpenGL generate a texture object handle for us
|
||||
glGenTextures( 1, &texture );
|
||||
|
||||
|
||||
// Bind the texture object
|
||||
glBindTexture( GL_TEXTURE_2D, texture );
|
||||
|
||||
|
||||
// Set the texture's stretching properties
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
|
||||
|
@ -100,25 +98,25 @@ int main(int argc, char *argv[])
|
|||
memset(surface->pixels, 0x66, surface->w*surface->h);
|
||||
|
||||
// Edit the texture object's image data using the information SDL_Surface gives us
|
||||
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, surface->w, surface->h, 0,
|
||||
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, surface->w, surface->h, 0,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, surface->pixels );
|
||||
|
||||
//SDL_UnlockSurface(surface);
|
||||
}
|
||||
}
|
||||
else {
|
||||
printf("SDL could not load image.bmp: %s\n", SDL_GetError());
|
||||
SDL_Quit();
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Free the SDL_Surface only if it was successfully created
|
||||
if ( surface ) {
|
||||
if ( surface ) {
|
||||
SDL_FreeSurface( surface );
|
||||
}
|
||||
|
||||
|
||||
// Clear the screen before drawing
|
||||
glClear( GL_COLOR_BUFFER_BIT );
|
||||
|
||||
|
||||
// Bind the texture to which subsequent calls refer to
|
||||
glBindTexture( GL_TEXTURE_2D, texture );
|
||||
|
||||
|
@ -141,9 +139,7 @@ int main(int argc, char *argv[])
|
|||
glTexCoord2i( 0, 1 ); glVertex3f( 500, 410, 0 );
|
||||
glEnd();
|
||||
|
||||
#if !EMSCRIPTEN
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
#endif
|
||||
|
||||
glColor3ub(90, 255, 255);
|
||||
glBegin( GL_QUADS );
|
||||
|
@ -161,7 +157,7 @@ int main(int argc, char *argv[])
|
|||
glEnd();
|
||||
|
||||
SDL_GL_SwapBuffers();
|
||||
|
||||
|
||||
#if !EMSCRIPTEN
|
||||
// Wait for 3 seconds to give us a chance to see the image
|
||||
SDL_Delay(3000);
|
||||
|
@ -169,8 +165,8 @@ int main(int argc, char *argv[])
|
|||
|
||||
// Now we can delete the OpenGL texture and close down SDL
|
||||
glDeleteTextures( 1, &texture );
|
||||
|
||||
|
||||
SDL_Quit();
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -46,14 +46,12 @@ int main(int argc, char *argv[])
|
|||
printf("Unable to set video mode: %s\n", SDL_GetError());
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
// Set the OpenGL state after creating the context with SDL_SetVideoMode
|
||||
|
||||
glClearColor( 0, 0, 0, 0 );
|
||||
|
||||
#if !EMSCRIPTEN
|
||||
glEnable( GL_TEXTURE_2D ); // Need this to display a texture XXX unnecessary in OpenGL ES 2.0/WebGL
|
||||
#endif
|
||||
|
||||
glEnable( GL_TEXTURE_2D ); // Needed when we're using the fixed-function pipeline.
|
||||
|
||||
glViewport( 0, 0, 640, 480 );
|
||||
|
||||
|
@ -66,30 +64,30 @@ int main(int argc, char *argv[])
|
|||
|
||||
glMatrixMode( GL_MODELVIEW );
|
||||
glLoadIdentity();
|
||||
|
||||
|
||||
// Load the OpenGL texture
|
||||
|
||||
GLuint texture; // Texture object handle
|
||||
SDL_Surface *surface; // Gives us the information to make the texture
|
||||
|
||||
if ( (surface = IMG_Load("screenshot.png")) ) {
|
||||
|
||||
|
||||
if ( (surface = IMG_Load("screenshot.png")) ) {
|
||||
|
||||
// Check that the image's width is a power of 2
|
||||
if ( (surface->w & (surface->w - 1)) != 0 ) {
|
||||
printf("warning: image.bmp's width is not a power of 2\n");
|
||||
}
|
||||
|
||||
|
||||
// Also check if the height is a power of 2
|
||||
if ( (surface->h & (surface->h - 1)) != 0 ) {
|
||||
printf("warning: image.bmp's height is not a power of 2\n");
|
||||
}
|
||||
|
||||
|
||||
// Have OpenGL generate a texture object handle for us
|
||||
glGenTextures( 1, &texture );
|
||||
|
||||
|
||||
// Bind the texture object
|
||||
glBindTexture( GL_TEXTURE_2D, texture );
|
||||
|
||||
|
||||
// Set the texture's stretching properties
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
|
||||
|
@ -100,25 +98,25 @@ int main(int argc, char *argv[])
|
|||
memset(surface->pixels, 0x66, surface->w*surface->h);
|
||||
|
||||
// Edit the texture object's image data using the information SDL_Surface gives us
|
||||
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, surface->w, surface->h, 0,
|
||||
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, surface->w, surface->h, 0,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, surface->pixels );
|
||||
|
||||
//SDL_UnlockSurface(surface);
|
||||
}
|
||||
}
|
||||
else {
|
||||
printf("SDL could not load image.bmp: %s\n", SDL_GetError());
|
||||
SDL_Quit();
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Free the SDL_Surface only if it was successfully created
|
||||
if ( surface ) {
|
||||
if ( surface ) {
|
||||
SDL_FreeSurface( surface );
|
||||
}
|
||||
|
||||
|
||||
// Clear the screen before drawing
|
||||
glClear( GL_COLOR_BUFFER_BIT );
|
||||
|
||||
|
||||
// Bind the texture to which subsequent calls refer to
|
||||
glBindTexture( GL_TEXTURE_2D, texture );
|
||||
|
||||
|
@ -151,7 +149,7 @@ int main(int argc, char *argv[])
|
|||
glEnd();
|
||||
|
||||
SDL_GL_SwapBuffers();
|
||||
|
||||
|
||||
#if !EMSCRIPTEN
|
||||
// Wait for 3 seconds to give us a chance to see the image
|
||||
SDL_Delay(3000);
|
||||
|
@ -159,8 +157,8 @@ int main(int argc, char *argv[])
|
|||
|
||||
// Now we can delete the OpenGL texture and close down SDL
|
||||
glDeleteTextures( 1, &texture );
|
||||
|
||||
|
||||
SDL_Quit();
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -16,7 +16,8 @@ datadir = $(prefix)/share
|
|||
infodir = $(datadir)/info
|
||||
mandir = $(datadir)/man
|
||||
sysconfdir = $(prefix)/etc
|
||||
CPPFLAGS = -DDECODER_ONLY=$(DECODER_ONLY)
|
||||
CXX = g++
|
||||
CPPFLAGS =
|
||||
CXXFLAGS = -Wall -W -O2
|
||||
LDFLAGS =
|
||||
|
||||
|
@ -27,16 +28,16 @@ INSTALL_DATA = $(INSTALL) -p -m 644
|
|||
INSTALL_DIR = $(INSTALL) -d -m 755
|
||||
SHELL = /bin/sh
|
||||
|
||||
objs = decoder.o encoder.o fast_encoder.o main.o
|
||||
recobjs = decoder.o lziprecover.o
|
||||
unzobjs = unzcrash.o
|
||||
objs = arg_parser.o decoder.o encoder.o fast_encoder.o main.o
|
||||
recobjs = arg_parser.o decoder.o lziprecover.o
|
||||
unzobjs = arg_parser.o unzcrash.o
|
||||
|
||||
|
||||
.PHONY : all install install-info install-man install-strip \
|
||||
uninstall uninstall-info uninstall-man \
|
||||
doc info man check dist clean distclean
|
||||
|
||||
all : $(progname)
|
||||
all : $(progname) lziprecover
|
||||
|
||||
$(progname) : $(objs)
|
||||
$(CXX) $(LDFLAGS) -o $@ $(objs)
|
||||
|
@ -63,12 +64,13 @@ unzcrash.o : testsuite/unzcrash.cc
|
|||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $<
|
||||
|
||||
$(objs) : Makefile
|
||||
arg_parser.o : arg_parser.h
|
||||
decoder.o : lzip.h decoder.h
|
||||
encoder.o : lzip.h encoder.h
|
||||
fast_encoder.o : lzip.h encoder.h fast_encoder.h
|
||||
main.o : lzip.h decoder.h encoder.h fast_encoder.h
|
||||
lziprecover.o : lzip.h decoder.h Makefile
|
||||
unzcrash.o : Makefile
|
||||
main.o : arg_parser.h lzip.h decoder.h encoder.h fast_encoder.h
|
||||
lziprecover.o : arg_parser.h lzip.h decoder.h Makefile
|
||||
unzcrash.o : arg_parser.h Makefile
|
||||
|
||||
|
||||
doc : info man
|
||||
|
|
Загрузка…
Ссылка в новой задаче