ImageRendering
From SWWorkshop
Loading image files, bind OpenGL and set texture properties is'nt simple operations. SWEngine simplifies these operations and provides clear API for image rendering. It supports 24/32 bit TGA files.
Api Doc
SwEngine, swGraphics, swPoint, swRect, swApplication
Source Code
#include "../../include/SWEngine.h" #pragma comment (lib,"../../lib/SWUtil.lib") #pragma comment (lib,"../../lib/SWTypes.lib") #pragma comment (lib,"../../lib/SWCore.lib") #pragma comment (lib,"../../lib/SWEngine.lib") swApplication imgRenderingApp; int imgID; //Img1 Setting swRect target1={200,200,128,64}; //Img2 Setting swRect target2={400,200,128,64}; //Img3 Setting swRect target3={400,300,128,64}; swRect source={1,1,-1,-1}; swPoint weight={0.5,0.5}; //------------------------------------------------------------------------------------------- void GameLoop(){ swGraphicsBeginScene(); //Background swGraphicsSetBgColor0(0,0,0.6); //BlendingMode swGraphicsSetBlendingMode(SW_BLENDING_MODE_SOLID); //Draw Image swGraphicsSetColor0(1,1,1,1); swGraphicsRenderImg0(imgID,&target1); swGraphicsRenderImg1(imgID,&target2,60); swGraphicsRenderImg2(imgID,&target3,&source); swGraphicsEndScene(); } //------------------------------------------------------------------------------------------- int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nShowCmd) { //Application Settings imgRenderingApp.hInstance=hInstance; imgRenderingApp.fullScreen=false; imgRenderingApp.cursor=true; imgRenderingApp.width=800; imgRenderingApp.height=600; imgRenderingApp.title="Image Rendering"; imgRenderingApp.path="\\rsc\\ImgRendering\\"; imgRenderingApp.appRun=GameLoop; //Application Execution swEngineInit(&imgRenderingApp); //Init My Application imgID=swGraphicsCreateImg("Defender.tga"); swEngineRun(); swEngineExit(); return 0; }

