Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualnkarasch

Posted 29 December 2012 - 08:03 PM

When the model loads for the first time,

		int vaoId = glGenVertexArrays();
		glBindVertexArray(vaoId);
		
		int vboVertexHandle = glGenBuffers();
		int vboNormalHandle = glGenBuffers();
		
		glBindBuffer(GL_ARRAY_BUFFER, vboVertexHandle);
		glBufferData(GL_ARRAY_BUFFER, vertices, GL_STATIC_DRAW);
		glVertexAttribPointer(0, 3, GL_FLOAT, false, 0, 0);
		
		glBindBuffer(GL_ARRAY_BUFFER, vboNormalHandle);
		glBufferData(GL_ARRAY_BUFFER, normals, GL_STATIC_DRAW);
		glVertexAttribPointer(1, 3, GL_FLOAT, false, 0, 0);
		
		glBindBuffer(GL_ARRAY_BUFFER, 0);
		glBindVertexArray(0);
		return vaoId;

and every time it renders it runs

                glBindVertexArray(vao);
		glEnableVertexAttribArray(0);
		glEnableVertexAttribArray(1);

		glUseProgram(shaderProgram);
		glDrawArrays(GL_TRIANGLES, 0, model.getVertices().size() * 6);
		glUseProgram(0);
		glBindBuffer(GL_ARRAY_BUFFER, 0);
		glBindVertexArray(0);

It is amazing how a three letter acronym through me off. I'm having a weird issue where only one side of each model is being shaded but I'll figure it out.


#2nkarasch

Posted 29 December 2012 - 07:55 PM

When the model loads for the first time,

		int vaoId = glGenVertexArrays();
		glBindVertexArray(vaoId);
		
		int vboVertexHandle = glGenBuffers();
		int vboNormalHandle = glGenBuffers();
		
		glBindBuffer(GL_ARRAY_BUFFER, vboVertexHandle);
		glBufferData(GL_ARRAY_BUFFER, vertices, GL_STATIC_DRAW);
		glVertexAttribPointer(0, 3, GL_FLOAT, false, 0, 0);
		
		glBindBuffer(GL_ARRAY_BUFFER, vboNormalHandle);
		glBufferData(GL_ARRAY_BUFFER, normals, GL_STATIC_DRAW);
		glVertexAttribPointer(1, 3, GL_FLOAT, false, 0, 0);
		
		glBindBuffer(GL_ARRAY_BUFFER, 0);
		glBindVertexArray(0);
		return vaoId;

and every time it renders it runs

                glBindVertexArray(vao);
		glEnableVertexAttribArray(0);
		glEnableVertexAttribArray(1);

		glUseProgram(shaderProgram);
		glDrawArrays(GL_TRIANGLES, 0, model.getVertices().size() * 6);
		glUseProgram(0);
		glBindBuffer(GL_ARRAY_BUFFER, 0);
		glBindVertexArray(0);

It is amazing how a three letter acronym through me off. I'm having a weird issue where only one side of each face is being shaded but I'll figure it out. And yes, I have edited this post that many times.


#1nkarasch

Posted 29 December 2012 - 07:49 PM

When the model loads for the first time,

		int vaoId = glGenVertexArrays();
		glBindVertexArray(vaoId);
		
		int vboVertexHandle = glGenBuffers();
		int vboNormalHandle = glGenBuffers();
		
		glBindBuffer(GL_ARRAY_BUFFER, vboVertexHandle);
		glBufferData(GL_ARRAY_BUFFER, vertices, GL_STATIC_DRAW);
		glVertexAttribPointer(0, 3, GL_FLOAT, false, 0, 0);
		
		glBindBuffer(GL_ARRAY_BUFFER, vboNormalHandle);
		glBufferData(GL_ARRAY_BUFFER, normals, GL_STATIC_DRAW);
		glVertexAttribPointer(1, 3, GL_FLOAT, false, 0, 0);
		
		glBindBuffer(GL_ARRAY_BUFFER, 0);
		glBindVertexArray(0);
		return vaoId;

and every time it renders it runs

                glBindVertexArray(vao);
		glEnableVertexAttribArray(0);
		glEnableVertexAttribArray(1);

		glUseProgram(shaderProgram);
		glDrawArrays(GL_TRIANGLES, 0, model.getVertices().size() * 6);
		glUseProgram(0);
		glBindBuffer(GL_ARRAY_BUFFER, 0);
		glBindVertexArray(0);

It is amazing how a three letter acronym through me off.


PARTNERS