[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [PROGRAMMERING] 2D OpenGL vs. Canvas





Det er ved hjælp af OpenGL muligt at uploade sine textures til hardwaren. Så det går hurtigt !!!

GLuint textID[1];
glGenTextures(1, &textID[0]);
glBindTexture( GL_TEXTURE_2D, &textID[0]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA,
GL_UNSIGNED_BYTE, &image);


// ... Senere i programmet...
glEnable( GL_TEXTURE_2D );
glBindTexture( GL_TEXTURE_2D, &textID[0]);
glBegin( GL_QUADS );
glTexCoord2i(0, 0); glVertex2i(...);
glTexCoord2i(0, 1); glVertex2i(...);
glTexCoord2i(1, 1); glVertex2i(...);
glTexCoord2i(1, 0); glVertex2i(...);
glEnd(); glDisable( GL_TEXTURE_2D );

Ser ud til du har truffet den rigtige beslutning :=) Og pludselig en dag vil du gerne lave noget fancy 3D-agitgt -- så er det rart at API'et ikke siger "NEJ" :)


- Peter



 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 22:43 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *