本文整理匯總了C#中SharpGL.OpenGL.End方法的典型用法代碼示例。如果您正苦於以下問題:C# OpenGL.End方法的具體用法?C# OpenGL.End怎麽用?C# OpenGL.End使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類SharpGL.OpenGL
的用法示例。
在下文中一共展示了OpenGL.End方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Draw3D
public override void Draw3D(OpenGL gl)
{
float drawCoord = (int)(y * 2) % pieces;
float size = 2;
double theta = 0;
if (fever)
{
size = 3f;
if (xpos < -4)
theta = (xpos + 4) * Math.PI / 4;
else if (xpos > 4)
theta = (xpos - 4) * Math.PI / 4;
}
gl.Begin(BeginMode.Quads);
{
if (fever)
gl.Color(1.0f, 0.5f, 0.5f);
gl.TexCoord(drawCoord / pieces, 1);
gl.Vertex(xpos * 0.5f - (0.4f * size) * Math.Cos(theta), y - (0.4f * size) * Math.Sin(theta), 0);
gl.TexCoord(drawCoord / pieces, 0);
gl.Vertex(xpos * 0.5f - (0.4f * size) * Math.Cos(theta), y - (0.4f * size) * Math.Sin(theta), size);
gl.TexCoord((drawCoord + 1) / pieces, 0);
gl.Vertex(xpos * 0.5f + (0.4f * size) * Math.Cos(theta), y + (0.4f * size) * Math.Sin(theta), size);
gl.TexCoord((drawCoord + 1) / pieces, 1);
gl.Vertex(xpos * 0.5f + (0.4f * size) * Math.Cos(theta), y + (0.4f * size) * Math.Sin(theta), 0);
gl.Color(1.0f, 1.0f, 1.0f);
}
gl.End();
}
示例2: DrawQuadsWithTexture
private void DrawQuadsWithTexture(OpenGL gl, int texture, params int[][][] quads)
{
gl.BindTexture(OpenGL.GL_TEXTURE_2D, _textures[texture]);
gl.Begin(OpenGL.GL_QUADS);
foreach (var quad in quads)
{
gl.TexCoord(0.0f, 0.0f); gl.Vertex(quad[0]);
gl.TexCoord(1.0f, 0.0f); gl.Vertex(quad[1]);
gl.TexCoord(1.0f, 1.0f); gl.Vertex(quad[2]);
gl.TexCoord(0.0f, 1.0f); gl.Vertex(quad[3]);
}
gl.End();
}
示例3: paint
public void paint(OpenGL gl)
{
gl.Color(1f, 1f, 1f);
gl.Begin(OpenGL.GL_TRIANGLE_STRIP);
gl.Vertex(x, y + height, 0);
gl.Vertex(x, y, 0);
gl.Vertex(x+width, y + height, 0);
gl.Vertex(x+width, y, 0);
gl.End();
gl.LineWidth(1);
gl.Begin(OpenGL.GL_LINES);
gl.Color(0, 0, 0);
if (centerCoordinateX <= x + width && centerCoordinateX >= x)
{
gl.Vertex4d(centerCoordinateX, y, 0, 1);
gl.Vertex4d(centerCoordinateX, y + height, 0, 1);
}
if (centerCoordinateY <= y + height && centerCoordinateY >= y)
{
gl.Vertex4d(x, centerCoordinateY, 0, 1);
gl.Vertex4d(x+width, centerCoordinateY, 0, 1);
}
gl.End();
for(int i = 0; i < functions.Count; i++)
{
drawFunction(gl, functions.ElementAt(i));
}
}
示例4: Draw
public static void Draw(OpenGL gl, double height, double length, double width)
{
gl.LineWidth(1);
gl.Color(0.7, 0.7, 0.7);
gl.Begin(OpenGL.GL_LINE_LOOP);
gl.Vertex(0, height, 0 );
gl.Vertex(0, height, width);
gl.Vertex(length, height, width);
gl.Vertex(length, height, 0 );
gl.End();
gl.Begin(OpenGL.GL_LINES);
gl.Vertex(0, height, 0);
gl.Vertex(0, 0, 0);
gl.Vertex(length, height, 0);
gl.Vertex(length, 0, 0);
gl.Vertex(0, height, width);
gl.Vertex(0, 0, width);
gl.Vertex(length, height, width);
gl.Vertex(length, 0, width);
gl.End();
gl.Begin(OpenGL.GL_LINE_LOOP);
gl.Vertex(0, 0, 0);
gl.Vertex(0, 0, width);
gl.Vertex(length, 0, width);
gl.Vertex(length, 0, 0);
gl.End();
}
示例5: DrawTrefoilVertices
private void DrawTrefoilVertices(OpenGL gl)
{
// Render each vertex.
gl.Begin(BeginMode.Points);
foreach(var vertex in trefoilKnot.Vertices)
gl.Vertex(vertex);
gl.End();
}
示例6: RenderVertices_Immediate
private void RenderVertices_Immediate(OpenGL gl)
{
gl.Color(1f, 0f, 0f);
gl.Begin(OpenGL.GL_POINTS);
for(uint i=0;i<vertices.Length; i++)
{
gl.Vertex(vertices[i]);
}
gl.End();
}
示例7: DrawGrid
public void DrawGrid(OpenGL gl, int camX,int camY)
{
gl.Clear(OpenGL.GL_COLOR_BUFFER_BIT | OpenGL.GL_DEPTH_BUFFER_BIT);
gl.LoadIdentity();
int MapHeight = tileMap.mapHeight;
int MapWidth = tileMap.mapWidth;
float[] darkColor = { 0.2f, 0.2f, 0.2f };
float[] lightColor = { 0.25f, 0.25f, 0.25f };
for (int h = 0; h < MapHeight; h++)
{
if (h % 10 == 0)
{
gl.LineWidth(2.0f);
gl.Color(lightColor);
}
else
{
gl.LineWidth(1.0f);
gl.Color(darkColor);
}
if (h == 0)
{
gl.LineWidth(4.0f);
gl.Color(lightColor);
}
gl.Begin(OpenGL.GL_LINES); // Start Drawing Verticle Cell Borders
gl.Vertex(0 - camX, h * tileSize - camY, 0);// Left Side Of Horizontal Line
gl.Vertex((MapWidth * tileSize) - camX, (h * tileSize) - camY, 0);// Right Side Of Horizontal Line
gl.End();
}
for (int v = 0; v < MapWidth; v++)
{
if (v % 10 == 0)
{
gl.LineWidth(2.0f);
gl.Color(lightColor);
}
else
{
gl.LineWidth(1.0f);
gl.Color(darkColor);
}
if (v == 0)
{
gl.LineWidth(4.0f);
gl.Color(lightColor);
}
gl.Begin(OpenGL.GL_LINES); // Start Drawing Verticle Cell Borders
gl.Vertex(v * tileSize - camX, 0 - camY, 0);// Left Side Of Horizontal Line
gl.Vertex((v * tileSize) - camX, (MapHeight * tileSize) - camY, 0);// Right Side Of Horizontal Line
gl.End();
}
}
示例8: drawCoordinateAxes
private void drawCoordinateAxes(OpenGL gl)
{
gl.Color(OpenGlUtility.GetOpenGlColor(Color.Red));
gl.Begin(OpenGL.GL_LINES);
gl.Vertex(0, 0, 0);
gl.Vertex(100, 0, 0);
gl.End();
gl.Color(OpenGlUtility.GetOpenGlColor(Color.Green));
gl.Begin(OpenGL.GL_LINES);
gl.Vertex(0, 0, 0);
gl.Vertex(0, 100, 0);
gl.End();
gl.Color(OpenGlUtility.GetOpenGlColor(Color.Blue));
gl.Begin(OpenGL.GL_LINES);
gl.Vertex(0, 0, 0);
gl.Vertex(0, 0, 100);
gl.End();
}
示例9: Bed
private void Bed(OpenGL gl, double x, double y, double z, double width, double height)
{
gl.Begin(OpenGL.GL_QUADS);
gl.Color(1f, 1f, 1f, 1f);
gl.Vertex(x, y + height, -6.0f);
gl.Vertex(x, y, -6.0f);
gl.Vertex(x + width, y, -6.0f);
gl.Vertex(x + width, y + height, -6.0f);
gl.End();
}
示例10: Ball
private void Ball(OpenGL gl)
{
gl.Begin(OpenGL.GL_LINE_LOOP);
for (int i = 0; i <= 10; i++)
{
double angle = (2 * Math.PI * i / 10);
double x = Math.Cos(angle) - ballX;
double y = Math.Sin(angle) - ballY;
gl.Vertex(x, y, ballz);
}
gl.End();
}
示例11: Draw
public override void Draw(OpenGL gl)
{
PointFloat _size = GetSize();
PointFloat[] pointData = RenderLogics.RectPoint(GetPosition(), _size, GetRotation());
byte[] color = GetColor();
GetTexture().UseTexure(gl);
gl.Begin(OpenGL.GL_QUADS);
gl.Color(color[0], color[1], color[2]);
gl.TexCoord(0, 0);
gl.Vertex(pointData[1].x, pointData[1].y);
gl.TexCoord(0, 1);
gl.Vertex(pointData[0].x, pointData[0].y);
gl.TexCoord(1, 1);
gl.Vertex(pointData[3].x, pointData[3].y);
gl.TexCoord(1, 0);
gl.Vertex(pointData[2].x, pointData[2].y);
gl.End();
}
示例12: CreateDisplayList
private void CreateDisplayList(OpenGL gl)
{
displayList = new DisplayList();
displayList.Generate(gl);
displayList.New(gl, DisplayList.DisplayListMode.CompileAndExecute);
//Push all attributes, disable lighting and depth testing.
gl.PushAttrib(OpenGL.GL_CURRENT_BIT | OpenGL.GL_ENABLE_BIT |
OpenGL.GL_LINE_BIT | OpenGL.GL_DEPTH_BUFFER_BIT);
gl.Disable(OpenGL.GL_LIGHTING);
gl.Disable(OpenGL.GL_TEXTURE_2D);
gl.DepthFunc(OpenGL.GL_ALWAYS);
//Set line width.
gl.LineWidth(lineWidth);
//Draw the line.
gl.Begin(OpenGL.GL_LINES);
for (float i = (size * -1); i < size; i+=0.4f)
{
float add = 0.2f;
if (i > 0) add = 0.4f;
if (i < 0 && i > -0.2f) add = 0.4f;
gl.Color(1f, 0f, 0f, 1f);
gl.Vertex(i, 0, 0);
gl.Vertex(i + add, 0, 0);
gl.Color(0f, 1f, 0f, 1f);
gl.Vertex(0, i, 0);
gl.Vertex(0, i + add, 0);
gl.Color(0f, 0f, 1f, 1f);
gl.Vertex(0, 0, i);
gl.Vertex(0, 0, i + add);
}
gl.End();
// Restore attributes.
gl.PopAttrib();
displayList.End(gl);
}
示例13: Draw
public void Draw(OpenGL gl)
{
gl.BindTexture(OpenGL.GL_TEXTURE_2D, TextureID);
int[] amb_diff = { Colour.A, Colour.B, Colour.G, Colour.A };
gl.Material(OpenGL.GL_FRONT_AND_BACK, OpenGL.GL_AMBIENT_AND_DIFFUSE, amb_diff);
gl.Begin(OpenGL.GL_TRIANGLES);
for (int i = 0; i < 3; i++)
{
Position point = Verts[i].Point;
UV uv = Verts[i].UV;
if (uv != null)
gl.TexCoord(uv.U, uv.V);
gl.Vertex(point.X, point.Y, point.Z);
}
gl.End();
gl.BindTexture(OpenGL.GL_TEXTURE_2D, 0);
}
示例14: CreateDisplayList
private void CreateDisplayList(OpenGL gl)
{
displayList = new DisplayList();
displayList.Generate(gl);
displayList.New(gl, DisplayList.DisplayListMode.CompileAndExecute);
//Push all attributes, disable lighting and depth testing.
gl.PushAttrib(OpenGL.GL_CURRENT_BIT | OpenGL.GL_ENABLE_BIT |
OpenGL.GL_LINE_BIT | OpenGL.GL_DEPTH_BUFFER_BIT);
gl.Disable(OpenGL.GL_LIGHTING);
gl.Disable(OpenGL.GL_TEXTURE_2D);
gl.DepthFunc(OpenGL.GL_ALWAYS);
//Set line width.
gl.LineWidth(lineWidth);
//Draw the line.
gl.Begin(OpenGL.GL_LINES);
for (int i = (size * -1); i <= size; i++)
{
if (i != 0)
{
if ((i % 4) == 0)
gl.Color(Convert.ColorToGLColor(darkColor));
else
gl.Color(Convert.ColorToGLColor(lightColor));
gl.Vertex(i, (size * -1), 0);
gl.Vertex(i, size, 0);
gl.Vertex((size * -1), i, 0);
gl.Vertex(size, i, 0);
}
}
gl.End();
// Restore attributes.
gl.PopAttrib();
displayList.End(gl);
}
示例15: RenderImmediateMode
/// <summary>
/// Renders the scene in immediate mode.
/// </summary>
/// <param name="gl">The OpenGL instance.</param>
public void RenderImmediateMode(OpenGL gl)
{
// Setup the modelview matrix.
gl.MatrixMode(OpenGL.GL_MODELVIEW);
gl.LoadIdentity();
gl.MultMatrix(modelviewMatrix.to_array());
// Go through each group.
foreach (var mesh in meshes)
{
var texture = meshTextures.ContainsKey(mesh) ? meshTextures[mesh] : null;
if(texture != null)
texture.Bind(gl);
uint mode = OpenGL.GL_TRIANGLES;
if (mesh.indicesPerFace == 4)
mode = OpenGL.GL_QUADS;
else if(mesh.indicesPerFace > 4)
mode = OpenGL.GL_POLYGON;
// Render the group faces.
gl.Begin(mode);
for (int i = 0; i < mesh.vertices.Length; i++ )
{
gl.Vertex(mesh.vertices[i].x, mesh.vertices[i].y, mesh.vertices[i].z);
if(mesh.normals != null)
gl.Normal(mesh.normals[i].x, mesh.normals[i].y, mesh.normals[i].z);
if(mesh.uvs != null)
gl.TexCoord(mesh.uvs[i].x, mesh.uvs[i].y);
}
gl.End();
if(texture != null)
texture.Unbind(gl);
}
}