如何创建圆圈使用solidsphere以及如何用颜色填充圆圈 [英] How to create a circle use solidsphere and how to fill circle with color

查看:114
本文介绍了如何创建圆圈使用solidsphere以及如何用颜色填充圆圈的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请解释如何创建圈子

如何使用功能

 #include< Windows.h> 
#include< GL\glew.h>
#include< GL\freeglut.h>
#include< iostream>使用namespace std

;


void init(void)
{
glClearColor(0.0,0.0,1.0,0.0);
glMatrixMode(GL_PROJECTION);
gluOrtho2D(0.0,300.0,0.0,170.0);

}

void DrawSnowman(void)
{

glColor3f(1.0,1.0,1.0);


glTranslatef(70,100,3.00);
glutSolidSphere(12.0,30,50);






glFlush();

}
void main(int argc,char ** argv)
{
glutInit(& argc,argv);

glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowPosition(0,0);
glutInitWindowSize(1366,768);
glutCreateWindow(雪人);
init();
glutDisplayFunc(DrawSnowman);
glutMainLoop();
}





我的尝试:



i我试过但没有填充圈子中的颜色

这是代码

解决方案

你的问题真的不明确。如果我理解正确的话,你可以通过将z比例因子设置为零(1,1,0)来制作一个圆形(假设你的意思是二维形状),并且应该将球体展平并使其成为一个圆形圈。

please Explain that how to create circle
how to use funcations

#include <Windows.h>
#include <GL\glew.h>
#include <GL\freeglut.h>
#include <iostream>

using namespace std;


void init(void)
{
	glClearColor(0.0, 0.0, 1.0, 0.0);
	glMatrixMode(GL_PROJECTION);
	gluOrtho2D(0.0, 300.0, 0.0, 170.0);

}

void DrawSnowman(void)
{

	glColor3f(1.0, 1.0, 1.0);

	
	glTranslatef(70, 100, 3.00);
	glutSolidSphere(12.0, 30, 50);






	glFlush();

}
void main(int argc, char** argv)
{
	glutInit(&argc, argv);

	glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
	glutInitWindowPosition(0, 0);
	glutInitWindowSize(1366, 768);
	glutCreateWindow("Snowman");
	init();
	glutDisplayFunc(DrawSnowman);
	glutMainLoop();
}



What I have tried:

i am tried but not fill the color in the circle
this is code

解决方案

Your question is really not clear. If I understand you correctly, you can make a circle (assuming you mean the two dimensional shape) from a solid sphere by setting the z scaling factor to zero (1,1,0) and that should flatten the sphere and make it into a circle.


这篇关于如何创建圆圈使用solidsphere以及如何用颜色填充圆圈的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆