当前位置: 首页>>代码示例>>C++>>正文


C++ VertexArray::bind方法代码示例

本文整理汇总了C++中VertexArray::bind方法的典型用法代码示例。如果您正苦于以下问题:C++ VertexArray::bind方法的具体用法?C++ VertexArray::bind怎么用?C++ VertexArray::bind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在VertexArray的用法示例。


在下文中一共展示了VertexArray::bind方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: init

void init(Renderer &gfx, Context &ctx)
{
	// Use the compute shader to work magic on the texture
	gfx.beginCustomShader(shader_compute);
	gfx.setUniform("inTex", 0);
	gfx.setUniform("outTex", 1);
	glBindImageTexture(0, tex.getHandle(), 0, GL_FALSE, 0, GL_READ_ONLY, GL_RGBA16F);
	glBindImageTexture(1, tex_blurred.getHandle(), 0, GL_FALSE, 0, GL_READ_WRITE, GL_RGBA16F);
	glDispatchCompute(
		tex.getWidth() / NUM_GROUPS_X,
		tex.getHeight() / NUM_GROUPS_Y,
		1);

	const float vertices[] = {	
		-1.0f, -1.0f,
		+1.0f, -1.0f,
		+1.0f, +1.0f,
		+1.0f, +1.0f,
		-1.0f, +1.0f,
		-1.0f, -1.0f
	};

	vbo.create(GL_ARRAY_BUFFER, GL_STATIC_DRAW);
	vbo.bind();
	vbo.bufferData(sizeof(vertices), vertices);

	vao.create();
	vao.bind();
}
开发者ID:lightbits,项目名称:glterrain,代码行数:29,代码来源:blurcompute.cpp

示例2: init

void init(Renderer &gfx, Context &ctx)
{
	vao.create();
	vao.bind();

	//int tex_res_x = ctx.getWidth();
	//int tex_res_y = ctx.getHeight();

	velocity.Ping.init(GRID_RES, GRID_RES);
	velocity.Pong.init(GRID_RES, GRID_RES);
	pressure.Ping.init(GRID_RES, GRID_RES);
	pressure.Pong.init(GRID_RES, GRID_RES);
	div_field.init(GRID_RES, GRID_RES);
	
	tex_velocity.create(0, GL_RGB32F, GRID_RES, GRID_RES, GL_RG, GL_FLOAT, NULL);
	tex_pressure.create(0, GL_RGB32F, GRID_RES, GRID_RES, GL_RG, GL_FLOAT, NULL);

	tex_velocity.setTexParameteri(GL_NEAREST, GL_NEAREST, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE);
	tex_pressure.setTexParameteri(GL_NEAREST, GL_NEAREST, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE);

	screen_quad.create(Mesh::genScreenSpaceTexQuad());

	pressure.Ping.set(7, 5, vec2(10.0f, 0.0));
	pressure.Ping.set(6, 5, vec2(10.0f, 0.0));
	pressure.Ping.set(5, 5, vec2(10.0f, 0.0));
	pressure.Pong.set(7, 5, vec2(10.0f, 0.0));
	pressure.Pong.set(6, 5, vec2(10.0f, 0.0));
	pressure.Pong.set(5, 5, vec2(10.0f, 0.0));
}
开发者ID:lightbits,项目名称:glterrain,代码行数:29,代码来源:app_old.cpp

示例3: draw

//void Renderer::draw(const VertexArray& va, const ElementBuffer& eb, const ShaderProgram& shader) const
void Renderer::draw(const VertexArray& va, const ElementBuffer& eb, const ShaderProgram& shader)
{
    va.bind();
    eb.bind();  
    shader.bind();
    GLCall(glDrawElements(GL_TRIANGLES, eb.count(), GL_UNSIGNED_INT, nullptr));
    //
    // UNBIND [optional]... discuss
}
开发者ID:overkillstudios,项目名称:imt2531-assignment2-mirror,代码行数:10,代码来源:Renderer.cpp

示例4: drawCube

void drawCube(GLint program, VertexArray &VAO, VertexBuffer &VBO, const glm::vec3 & cubePosition)
{
	GLint locationModel = glGetUniformLocation(program, "model");

	// model input
	glm::mat4 model;
	model = glm::translate(model, glm::vec3(cubePosition));
	glUniformMatrix4fv(locationModel, 1, GL_FALSE, glm::value_ptr(model));

	VAO.bind();

	VBO.renderBuffer(GL_TRIANGLES, 0, 36);

	VAO.unbind();
}
开发者ID:nguyenchiemminhvu,项目名称:GLFW-projects,代码行数:15,代码来源:main.cpp

示例5: init

void init(Renderer &gfx, Context &ctx)
{	
	vao.create();
	vao.bind();

	cube_buffer.create(Mesh::genUnitCube(false, true, true));
	cube = Model(cube_buffer);

	skybox_buffer.create(Mesh::genUnitCube(false, false, true));
	skybox = Model(skybox_buffer);

	mat_view = mat4(1.0f);
	mat_projection = glm::perspective(PI / 5.0f, ctx.getWidth() / (float)ctx.getHeight(), 0.05f, 15.0f);

	camera.reset(0.0f, 0.0f, vec3(0.0f, 0.2f, 1.0f));
}
开发者ID:lightbits,项目名称:glterrain,代码行数:16,代码来源:app.cpp

示例6: render

void render(Renderer &gfx, Context &ctx, double dt)
{
	gfx.setClearDepth(1.0);
	gfx.setClearColor(0.2f, 0.2f, 0.3f);
	gfx.clearColorAndDepth();
	gfx.setDepthTestState(DepthTestStates::LessThanOrEqual);
	gfx.setCullState(CullStates::CullNone);

	gfx.beginCustomShader(shader);
	gfx.setUniform("view", mat4(1.0f));
	gfx.setUniform("projection", glm::perspective(45.0f, ctx.getWidth() / (float)ctx.getHeight(), 0.05f, 10.0f));
	gfx.setUniform("model", transform::translate(0.0f, 0.0f, -3.5f) * transform::rotateY(ctx.getElapsedTime()));

	vao.bind();
	vbo.bind(); // This is necessary
	// These aren't!
	//gfx.setAttributefv("position", 3, 7, 0);
	//gfx.setAttributefv("color", 4, 7, 3);

	// Update buffer with dynamic data
	float sint = sin(ctx.getElapsedTime());
	float cost = cos(ctx.getElapsedTime());
	float vertices[] = {
		-0.5f, -0.5f, 0.0f,		0.5f * sint + 0.5f, 0.5f * cost + 0.5f, 1.0f, 1.0f,
		 0.5f, -0.5f, 0.0f,		0.5f * sint + 0.5f, 0.5f * cost + 0.5f, 1.0f, 1.0f,
		 0.5f,  0.5f, 0.0f,		0.5f * sint + 0.5f, 0.5f * cost + 0.5f, 1.0f, 1.0f,

		 0.5f,  0.5f, 0.0f,		0.5f * sint + 0.5f, 0.5f * cost + 0.5f, 1.0f, 1.0f,
		-0.5f,  0.5f, 0.0f,		0.5f * sint + 0.5f, 0.5f * cost + 0.5f, 1.0f, 1.0f,
		-0.5f, -0.5f, 0.0f,		0.5f * sint + 0.5f, 0.5f * cost + 0.5f, 1.0f, 1.0f
	};
	vbo.bufferSubData(0, sizeof(vertices), vertices);

	glDrawArrays(GL_TRIANGLES, 0, 6);

	gfx.endCustomShader();	
}
开发者ID:lightbits,项目名称:glterrain,代码行数:37,代码来源:app.cpp

示例7: run

void run()
{
	if(!initialize())
		shutdown("Failed to initialize");

	if(!loadContent())
		shutdown("Failed to load resources");	

	Mesh cubeMesh = Mesh::genUnitColoredCube();
	MeshBuffer cubeBuffer(cubeMesh);
	Model cube(cubeBuffer);

	Mesh waterMesh = Mesh::genUnitColoredPlane(Color(0.57f, 0.63f, 0.98f));
	MeshBuffer waterBuffer(waterMesh);
	Model water(waterBuffer);

	BufferObject quadVbo;
	float quadVertices[] = {
		-1.0f, -1.0f, 0.0f, 0.0f,
		+1.0f, -1.0f, 1.0f, 0.0f,
		+1.0f, +1.0f, 1.0f, 1.0f,
		+1.0f, +1.0f, 1.0f, 1.0f,
		-1.0f, +1.0f, 0.0f, 1.0f,
		-1.0f, -1.0f, 0.0f, 0.0f
	};
	quadVbo.create(GL_ARRAY_BUFFER, GL_STATIC_DRAW, sizeof(quadVertices), quadVertices);

	Mesh gridMesh;
	for(int i = 0; i <= 8; ++i)
	{
		float f = (i / 8.0) * 2.0f - 1.0f;
		int j = gridMesh.getPositionCount();
		gridMesh.addPosition(f * 3.0f, 0.0f, -3.0f);
		gridMesh.addPosition(f * 3.0f, 0.0f, +3.0f);
		gridMesh.addPosition(-3.0f, 0.0f, f * 3.0f);
		gridMesh.addPosition(+3.0f, 0.0f, f * 3.0f);
		gridMesh.addColor(Colors::White);
		gridMesh.addColor(Colors::White);
		gridMesh.addColor(Colors::White);
		gridMesh.addColor(Colors::White);
		gridMesh.addIndex(j + 0); gridMesh.addIndex(j + 1);
		gridMesh.addIndex(j + 2); gridMesh.addIndex(j + 3);
	}
	MeshBuffer gridBuffer(gridMesh);
	Model grid(gridBuffer);

	VertexArray vao;
	vao.create();
	vao.bind();

	mat4 perspectiveMatrix = glm::perspective(45.0f, windowWidth / float(windowHeight), 0.05f, 50.0f);
	
	// The geometry to be refracted and reflected are stored in these
	// In addition to RGB values, the world-space height is stored in the alpha-channel
	// of the refraction texture.
	// Fresnel equations is used to blend between the two textures
	RenderTexture refractionRT(windowWidth, windowHeight);
	RenderTexture reflectionRT(windowWidth, windowHeight);

	renderer.setClearColor(0.55f, 0.45f, 0.45f, 1.0f);
	renderer.setClearDepth(1.0);

	Timer timer;
	timer.start();
	double renderTime = 0.0;

	while(context.isOpen())
	{
		timer.step();
		double time = timer.getElapsedTime();
		update(time, timer.getDelta());
		double renderStart = timer.getElapsedTime();

		MatrixStack viewMatrix;
		viewMatrix.push();
		viewMatrix.translate(0.0f, 0.0f, -3.0f);
		viewMatrix.rotateX(xAxisRotation);
		viewMatrix.rotateY(yAxisRotation);

		renderer.setCullState(CullStates::CullNone);
		renderer.setDepthTestState(DepthTestStates::LessThanOrEqual);
		
		colorShader.begin();
		colorShader.setUniform("projection", perspectiveMatrix);
		cube.pushTransform();
		cube.translate(0.0f, 0.0f, 0.0f);
		cube.scale(0.5f);

		// Render the geometry to be refracted, store result in rt
		refractionRT.begin();
		renderer.clearColorAndDepth();
		colorShader.setUniform("view", viewMatrix.top());
		cube.draw(GL_TRIANGLES);
		grid.draw(GL_LINES);
		refractionRT.end();

		// Render the geometry to be reflected, store result in rt
		reflectionRT.begin();
		renderer.clearColorAndDepth();
		viewMatrix.push();
//.........这里部分代码省略.........
开发者ID:lightbits,项目名称:glterrain,代码行数:101,代码来源:17water.cpp

示例8: main

int main(int argc, char **argv) {

	if (!glfwInit()) {
		return EXIT_FAILURE;
	}

	glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
	glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
	glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
	glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);
	glfwWindowHint(GLFW_SAMPLES, 2); // anti-aliasing

	GLFWwindow *window = glfwCreateWindow(WIDTH, HEIGHT, "Basic Shader", NULL, NULL);

	glfwMakeContextCurrent(window);
	glfwSetKeyCallback(window, key_callback);
	glfwSetCursorPosCallback(window, cursor_callback);
	glfwSetScrollCallback(window, scroll_callback);

	glewExperimental = GL_TRUE;
	glewInit();

	glViewport(0, 0, WIDTH, HEIGHT);

	////////////////////////////////////////
	// Setup shader program
	Shader *shader = new Shader("ShadersFile/VertexShader.sha", "ShadersFile/FragmentShader.sha");

	////////////////////////////////////////
	// Setup vertex data
	GLfloat vertices[] = {
		// Positions           // Normals				// Texture Coords
		-0.5f, -0.5f, -0.5f,	0.0f,  0.0f, -1.0f,		0.0f, 0.0f,
		0.5f, -0.5f, -0.5f,		0.0f,  0.0f, -1.0f,		1.0f, 0.0f,
		0.5f,  0.5f, -0.5f,		0.0f,  0.0f, -1.0f,		1.0f, 1.0f,
		0.5f,  0.5f, -0.5f,		0.0f,  0.0f, -1.0f,		1.0f, 1.0f,
		-0.5f,  0.5f, -0.5f,	0.0f,  0.0f, -1.0f,		0.0f, 1.0f,
		-0.5f, -0.5f, -0.5f,	0.0f,  0.0f, -1.0f,		0.0f, 0.0f,

		-0.5f, -0.5f,  0.5f,	0.0f,  0.0f, 1.0f,		0.0f, 0.0f,
		0.5f, -0.5f,  0.5f,		0.0f,  0.0f, 1.0f,		1.0f, 0.0f,
		0.5f,  0.5f,  0.5f,		0.0f,  0.0f, 1.0f,		1.0f, 1.0f,
		0.5f,  0.5f,  0.5f,		0.0f,  0.0f, 1.0f,		1.0f, 1.0f,
		-0.5f,  0.5f,  0.5f,	0.0f,  0.0f, 1.0f,		0.0f, 1.0f,
		-0.5f, -0.5f,  0.5f,	0.0f,  0.0f, 1.0f,		0.0f, 0.0f,

		-0.5f,  0.5f,  0.5f,	-1.0f,  0.0f,  0.0f,	1.0f, 0.0f,
		-0.5f,  0.5f, -0.5f,	-1.0f,  0.0f,  0.0f,	1.0f, 1.0f,
		-0.5f, -0.5f, -0.5f,	-1.0f,  0.0f,  0.0f,	0.0f, 1.0f,
		-0.5f, -0.5f, -0.5f,	-1.0f,  0.0f,  0.0f,	0.0f, 1.0f,
		-0.5f, -0.5f,  0.5f,	-1.0f,  0.0f,  0.0f,	0.0f, 0.0f,
		-0.5f,  0.5f,  0.5f,	-1.0f,  0.0f,  0.0f,	1.0f, 0.0f,

		0.5f,  0.5f,  0.5f,		1.0f,  0.0f,  0.0f,		1.0f, 0.0f,
		0.5f,  0.5f, -0.5f,		1.0f,  0.0f,  0.0f,		1.0f, 1.0f,
		0.5f, -0.5f, -0.5f,		1.0f,  0.0f,  0.0f,		0.0f, 1.0f,
		0.5f, -0.5f, -0.5f,		1.0f,  0.0f,  0.0f,		0.0f, 1.0f,
		0.5f, -0.5f,  0.5f,		1.0f,  0.0f,  0.0f,		0.0f, 0.0f,
		0.5f,  0.5f,  0.5f,		1.0f,  0.0f,  0.0f,		1.0f, 0.0f,

		-0.5f, -0.5f, -0.5f,	0.0f, -1.0f,  0.0f,		0.0f, 1.0f,
		0.5f, -0.5f, -0.5f,		0.0f, -1.0f,  0.0f,		1.0f, 1.0f,
		0.5f, -0.5f,  0.5f,		0.0f, -1.0f,  0.0f,		1.0f, 0.0f,
		0.5f, -0.5f,  0.5f,		0.0f, -1.0f,  0.0f,		1.0f, 0.0f,
		-0.5f, -0.5f,  0.5f,	0.0f, -1.0f,  0.0f,		0.0f, 0.0f,
		-0.5f, -0.5f, -0.5f,	0.0f, -1.0f,  0.0f,		0.0f, 1.0f,

		-0.5f,  0.5f, -0.5f,	0.0f,  1.0f,  0.0f,		0.0f, 1.0f,
		0.5f,  0.5f, -0.5f,		0.0f,  1.0f,  0.0f,		1.0f, 1.0f,
		0.5f,  0.5f,  0.5f,		0.0f,  1.0f,  0.0f,		1.0f, 0.0f,
		0.5f,  0.5f,  0.5f,		0.0f,  1.0f,  0.0f,		1.0f, 0.0f,
		-0.5f,  0.5f,  0.5f,	0.0f,  1.0f,  0.0f,		0.0f, 0.0f,
		-0.5f,  0.5f, -0.5f,	0.0f,  1.0f,  0.0f,		0.0f, 1.0f
	};

	///////////////////////////////////////
	// create VBO, VAO
	VertexArray VAO;
	VertexBuffer VBO(vertices, sizeof(vertices));

	VAO.bind();
	VBO.bind();

	// position attribute
	GLuint positionAttribLocation = glGetAttribLocation(shader->getProgramID(), "position");
	VAO.enableVertexAttribArray(positionAttribLocation, positionAttribLocation, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(GLfloat), (GLvoid*)(0));

	// normal attribute
	GLuint normalAttribLocation = glGetAttribLocation(shader->getProgramID(), "normal");
	VAO.enableVertexAttribArray(normalAttribLocation, normalAttribLocation, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(GLfloat), (GLvoid*)(3 * sizeof(GLfloat)));

	// texture attribute
	GLuint texCoordAttribLocation = glGetAttribLocation(shader->getProgramID(), "texCoord");
	VAO.enableVertexAttribArray(texCoordAttribLocation, texCoordAttribLocation, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(GLfloat), (GLvoid*)(6 * sizeof(GLfloat)));

	//////////////////////////////////////////
	// load texture
	Texture2D *texture = new Texture2D(2);

	texture->bind(0);
//.........这里部分代码省略.........
开发者ID:nguyenchiemminhvu,项目名称:GLFW-projects,代码行数:101,代码来源:main.cpp

示例9: main

int main() {
	Graphics::Window window("title", Vector2<int>(1800, 960));

	FileSystem fs;
   
	this_thread::sleep_for(std::chrono::seconds(1));
 	auto cube = MeshLoader::loadOBJ(&fs.getFile("scene/monkey.obj"));
  
	Transformation camera;
	Projection projection(0.01f, 1000.0f, 45, window.getAspect());
	Transformation model;
	Transformation light_t;
	   
	camera.setPosition({0 , 0 , .7f});

	GLenum err;
	// TEST 
	// cbuffer is deleted after being passed as rvalue
	auto tex = TextureLoader::loadTexture(fs.getFile("textures/box.bmp"));

	if (tex == nullptr || cube == nullptr) {
		return 1;
	}

	GLuint vbo = 0; 
	GLuint sampler = 0; 

	cube->bind(); 

	Shader vert(fs.getFile("shaders/shader.vert"), GL_VERTEX_SHADER);
	Shader frag(fs.getFile("shaders/shader.frag"), GL_FRAGMENT_SHADER);
	if ((err = glGetError()) != GL_NO_ERROR)
		return err;
	Program program;
	program.attachShader(vert);
	program.attachShader(frag);
	program.link();
	program.use();

	VertexArray vao;
	vao.bind(); 

	vao.setVertexAttribute(program, "in_normal", cube->getObjects().at(0).normalSize(), GL_FLOAT, GL_FALSE, cube->getObjects().at(0).stride(), cube->getObjects().at(0).normalOffset());
	vao.setVertexAttribute(program, "position", cube->getObjects().at(0).vertexSize(), GL_FLOAT, GL_FALSE, cube->getObjects().at(0).stride(), cube->getObjects().at(0).vertexOffset());
	vao.setVertexAttribute(program, "in_tex", cube->getObjects().at(0).texCoordSize(), GL_FLOAT, GL_FALSE, cube->getObjects().at(0).stride(), cube->getObjects().at(0).texCoordOffset());

	vao.unbind(); 

	program.setUniform("world_pos", Vector3<float>(.5, 0, 0));

	glActiveTexture(GL_TEXTURE0);
	tex->bind();
	  
	LightPoint point;
	point.position = { 2, 0, 0 };
	point.color = { 1, 1, 1 };
	point.intensity = 0.4f;
	point.attenuation = 10;

	light_t.setPosition(Vector3<float>(2, 1, 0));

	Lighting lights;

	LightPoint& light = lights.attachLight(point);

	lights.setAmbient(Vector3<float>(1.0f, 1.0f, 1.0f));

	float pos = 0;
	Vector3<float> rotation(0);

	while (false) {
		window.startFrame(); 
		vao.bind();
		//camera.rotate({ 0, 0, 0.01f }); 

		//window.getMouse().getMousePosition<float>(&light.position.x, &light.position.y); 
		light_t.setPosition(light.position);  
		model.setScale({ 0.1f, 0.1f, 0.1f });
		model.setPosition({ 0, -0.5f, 0 });
		std::this_thread::sleep_for(std::chrono::milliseconds(16));
		program.setUniform("model", model.getMatrix());
		program.setUniform("view", camera.getMatrix()); 
		program.setUniform("projection", projection.getPerspective());
		lights.bindLights(program);
		program.setUniform("normal_matrix", model.getNormalMatrix());
		cube->bind();
		 

		for (const auto& obj : cube->getObjects()){
			program.setUniform("has_normal", obj.hasNormals());
			program.setUniform("has_tex_coord", obj.hasTexCoord());
			glDrawElements(obj.getMode(), obj.size, GL_UNSIGNED_INT, obj.p_start); 
		}

		vao.unbind();

		if (window.getKeyboard().isKeyDown(KEY::KEY_W) != KEY_PRESSED::RELEASED)
			rotation.x += 0.1f;
		if (window.getKeyboard().isKeyDown(KEY::KEY_D) != KEY_PRESSED::RELEASED)
			rotation.y += 0.1f;
//.........这里部分代码省略.........
开发者ID:wackoisgod,项目名称:Protheus,代码行数:101,代码来源:LearnOGL.cpp

示例10: main

int main() {
	Graphics::Window window("scene", { 800, 600 });
	
	Util::FileSystem fs; 
	fs.setRootDir("");

	auto scene = MeshLoader::loadOBJ(&fs.getFile("scene/scene.obj"));
	auto tex = TextureLoader::loadTexture(&fs.getFile("scene/Wall.bmp"));

	Shader vert(fs.getFile("shaders/shader.vert"), GL_VERTEX_SHADER);
	Shader frag(fs.getFile("shaders/shader.frag"), GL_FRAGMENT_SHADER);

	GLuint err = 0;
	if ((err = glGetError()) != GL_NO_ERROR)
		return err;
	Program program;

	program.attachShader(vert);
	program.attachShader(frag);
	program.link();
	program.use();

	// Get a good error if this hasn't been bound.
	scene->bind();

	VertexArray vao;
	vao.bind();

	vao.setVertexAttribute(program, "in_normal", scene->normalSize(), GL_FLOAT, GL_FALSE, scene->stride(), scene->normalOffset());
	vao.setVertexAttribute(program, "position", scene->vertexSize(), GL_FLOAT, GL_FALSE, scene->stride(), scene->vertexOffset());
	vao.setVertexAttribute(program, "in_tex", scene->texCoordSize(), GL_FLOAT, GL_FALSE, scene->stride(), scene->texCoordOffset());

	vao.unbind();

	program.setUniform("has_normal", scene->hasNormals());
	program.setUniform("has_tex_coord", scene->hasTexCoord());
	program.setUniform("world_pos", Vector3<float>(.5, 0, 0));

	
	glActiveTexture(GL_TEXTURE0);
	tex->bind();

	LightPoint point;
	point.position = { 2, 0, 0 };
	point.color = { 1, 1, 1 };
	point.intensity = 10;
	point.attenuation = 10;
	  
	Lighting lights;

	LightPoint& light = lights.attachLight(point); 
	lights.setAmbient(Vector3<float>(1.0f, 1.0f, 1.0f));


	while (true /*window.isExitRequested()*/) {
		window.startFrame();

		for (const auto& obj : scene->getObjects()) {
			glDrawElements(scene->getMode(), obj.size, GL_UNSIGNED_INT, obj.p_start);
		}

		window.endFrame();
	}
	 
}
开发者ID:Allowed,项目名称:Protheus,代码行数:65,代码来源:scenetestcpp.cpp


注:本文中的VertexArray::bind方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。