Category: Ćwiczenia

  • Renderowanie Muchy w OpenGL

    Program stworzony razem ze studentami w ramach zajęc z przedmiotu Zaawansowane Techniki Programowania w Multimediach w semestrze 2017/2018 Mucha

    /*//
    _                    _             _
    | |    __ _ _ __ ___ | |__       _-(")-
    | |   / _` | '_ ` _ \| '_ \    `%%%%%
    | |__| (_| | | | |_| | |_) | _  // \\
    |_____\__,_|_| |_| |_|_.__/_| |__  ___
                     | |   / _` | '_ \/ __|
                     | |__| (_| | |_) \__ \
     2018-05-24      |_____\__,_|_.__/|___/
    //*/
    
    #include 
    #include 
    //#include 
    //#include 
    #include 
    #include 
    #include "res.h"
    
    #define IDT_REDRAW_FRAME 2018
    
    GLuint uiTextureEyeID;
    GLuint uiTextureBodyID;
    

    (więcej…)

  • Prosty program w OpenGL

    Przykładowy program wyświetlający sześcian w OPENGL

    /*//
    _                    _             _
    | |    __ _ _ __ ___ | |__       _-(")-
    | |   / _` | '_ ` _ \| '_ \    `%%%%%
    | |__| (_| | | | |_| | |_) | _  // \\
    |_____\__,_|_| |_| |_|_.__/_| |__  ___
                     | |   / _` | '_ \/ __|
                     | |__| (_| | |_) \__ \
     2018-05-24      |_____\__,_|_.__/|___/
    //*/
    
    #include 
    #include 
    #include 
    #include "res.h"
    
    #define IDT_REDRAW_FRAME 2018
    
    void DrawAxes(float a) {
      glPushMatrix();
      glScalef(a, a, a);
      glBegin(GL_LINES);
      glColor3f(0.0, 0.0, 1.0);
      glVertex3f(-10, 0, 0);
      glVertex3f(+10, 0, 0);
      glColor3f(0.0, 1.0, 0.0);
      glVertex3f(0, -10, 0);
      glVertex3f(0, +10, 0);
      glColor3f(1.0, 0.0, 0.0);
      glVertex3f(0, 0, -10);
      glVertex3f(0, 0, +10);
      glEnd();
      glPopMatrix();
    }
    

    (więcej…)

  • Funkcja wczytujca pliki BMP

    Funkcja umozliwiajaca wczytanie obrazka z pliku BMP

    unsigned char* ReadBmpFromFile(char* szFileName,int &riWidth, int &riHeight)
    {
    	BITMAPFILEHEADER     bfh;
    	BITMAPINFOHEADER     bih;
    
    	int                i,j,h,v,lev,l,ls;
    	unsigned char*     buff = NULL;  
    
      unsigned char* p_palette = NULL;
      unsigned short n_colors = 0;
    
      unsigned char* pRGBBuffer;
    
      FILE* hfile = fopen(szFileName,"rb");
    
    	if(hfile!=NULL)
    	{
        fread(&bfh,sizeof(bfh),1,hfile);
    		if(!(bfh.bfType != 0x4d42 || (bfh.bfOffBits < (sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER)))) )
    		{
          fread(&bih,sizeof(bih),1,hfile);
    			v   = bih.biWidth;
    			h   = bih.biHeight;
    			lev = bih.biBitCount;
    			
          riWidth = v;
          riHeight = h;
          pRGBBuffer = new unsigned char [riWidth*riHeight*3]; //Zaalokowanie odpowiedniego buffora obrazu
          
          //Załaduj Palete barw jesli jest
          if((lev==1)||(lev==4)||(lev==8))
          {
            n_colors = 1<=0;j--)
    				{
              fread(buff,ls,1,hfile);
              for(i=0,l=0;i=0;j--)
    				{
    					//x_fread(hfile,buff,ls);
              fread(buff,ls,1,hfile);
    					for(i=0,l=0;i=0;j--)
    				{
              fread(buff,v*4,1,hfile);
    					for(i=0,l=0;i
    
  • Podstawy debugowania w Visual Studio

    https://blogs.msdn.microsoft.com/vcblog/2017/04/10/c-debugging-and-diagnostics/