include/GizegoEngine.h
//An image must be finalized before it can be rendered. This must be done after the window creation. Trying to edit an image or set it as an icon after finalization will crash the program.
An image must be finalized before it can be rendered. This must be done after the window creation. Trying to edit an image or set it as an icon after finalization will crash the program.
An image must be finalized before it can be rendered . This must be done after the window creation . Trying to edit an image or set it as an icon after finalization will crash the program .
void Finalize()
		{
			HALF_VERT vecs[12] = 
			{
				0, 0,
				(int)m_width, (int)m_height,
				(int)m_width, 0,
				0, 0,
				(int)m_width, (int)m_height,
				0, (int) m_height
			};
			float tcs[12] = { 
				0, 0,
				1, 1,
				1, 0,
				0, 0,
				1, 1,
				0, 1
			};
			glGenVertexArrays(1, &m_vao);
			Bind();
			glGenBuffers(1, &m_vbo);
			glBindBuffer(GL_ARRAY_BUFFER, m_vbo);
			glBufferData(GL_ARRAY_BUFFER, sizeof(vecs), vecs, GL_STATIC_DRAW);
			glVertexAttribPointer(0, 2, VERTEX_TYPE, GL_FALSE, sizeof(int) * 2, NULL);		
			glGenBuffers(1, &m_tbo);
			glBindBuffer(GL_ARRAY_BUFFER, m_tbo);
			glBufferData(GL_ARRAY_BUFFER, sizeof(tcs), tcs, GL_STATIC_DRAW);
			glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, sizeof(float) * 2, NULL);
			glGenTextures(1 ,&m_tex);
			Bind();
			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
			glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_width, m_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, m_data);
			stbi_image_free(m_data);
			m_data = NULL;
			glBindBuffer(GL_ARRAY_BUFFER, 0);
		}
void Finalize ( ) { HALF_VERT vecs [ 12 ] = { 0 , 0 , ( int ) m_width , ( int ) m_height , ( int ) m_width , 0 , 0 , 0 , ( int ) m_width , ( int ) m_height , 0 , ( int ) m_height } ; float tcs [ 12 ] = { 0 , 0 , 1 , 1 , 1 , 0 , 0 , 0 , 1 , 1 , 0 , 1 } ; glGenVertexArrays ( 1 , & m_vao ) ; Bind ( ) ; glGenBuffers ( 1 , & m_vbo ) ; glBindBuffer ( GL_ARRAY_BUFFER , m_vbo ) ; glBufferData ( GL_ARRAY_BUFFER , sizeof ( vecs ) , vecs , GL_STATIC_DRAW ) ; glVertexAttribPointer ( 0 , 2 , VERTEX_TYPE , GL_FALSE , sizeof ( int ) * 2 , NULL ) ; glGenBuffers ( 1 , & m_tbo ) ; glBindBuffer ( GL_ARRAY_BUFFER , m_tbo ) ; glBufferData ( GL_ARRAY_BUFFER , sizeof ( tcs ) , tcs , GL_STATIC_DRAW ) ; glVertexAttribPointer ( 1 , 2 , GL_FLOAT , GL_FALSE , sizeof ( float ) * 2 , NULL ) ; glGenTextures ( 1 , & m_tex ) ; Bind ( ) ; glTexParameteri ( GL_TEXTURE_2D , GL_TEXTURE_MIN_FILTER , GL_NEAREST ) ; glTexParameteri ( GL_TEXTURE_2D , GL_TEXTURE_MAG_FILTER , GL_NEAREST ) ; glTexParameteri ( GL_TEXTURE_2D , GL_TEXTURE_WRAP_S , GL_CLAMP_TO_EDGE ) ; glTexParameteri ( GL_TEXTURE_2D , GL_TEXTURE_WRAP_T , GL_CLAMP_TO_EDGE ) ; glTexImage2D ( GL_TEXTURE_2D , 0 , GL_RGBA , m_width , m_height , 0 , GL_RGBA , GL_UNSIGNED_BYTE , m_data ) ; stbi_image_free ( m_data ) ; m_data = NULL ; glBindBuffer ( GL_ARRAY_BUFFER , 0 ) ; }
An image must be finalized before it can be rendered.
An image must be finalized before it can be rendered .
//VAO //VBO //TBO //TEXTURE //DELETING OLD IMAGE