简体   繁体   English

在iPhone OpenGL或Coregraphics中绘制光泽圆的最佳方法是什么?

[英]What is the best way to draw a glossy circle in iPhone OpenGL or Coregraphics?

I want to draw a circle on the iPhone screen with Shadow and glossy effect.I am new to coreGraphics and OpenGL and dont really know the difference between the two.And which library is to be used when. 我想在iPhone屏幕上画一个具有阴影和光泽效果的圆圈。我是coreGraphics和OpenGL的新手,并不真正了解两者之间的区别,以及何时使用哪个库。

How can I draw following image in iPhone? 如何在iPhone中绘制以下图像? any reference point to learn the appropriate library would be great. 学习适当的库的任何参考点都会很棒。

在此输入图像描述

have 3 of those images [ 1 ] [2] [3] and a slider to control the glow.when you slide to change the glow it should go across all these, and furthermore some levels could have upto 50 circles. 拥有其中的3张图像[ 1 ] [2] [3]和一个用于控制光晕的滑块。当您滑动以更改光晕时,它应该跨越所有这些图像,此外,某些级别最多可以包含50个圆圈。

OpenGL is not a library, it's an API that gives you a "no-frills" access to the graphics system. OpenGL不是一个库,它是一个API,可让您“毫不费力”地访问图形系统。 All it provides are graphics primitives (points, lines, triangles) that it places on the screen and rasterizes them applying colour, textures through mathematical formula and/or a program called shader. 它提供的只是图形基元(点,线,三角形),将其放置在屏幕上,并通过数学公式和/或称为着色器的程序应用颜色,纹理对其进行栅格化。

Sure, what you want to draw can be drawn using OpenGL, but it will require several intermediate steps and an artistic understanding of how that image is created from drawing operations. 当然,可以使用OpenGL绘制要绘制的图像,但这需要几个中间步骤,并且需要对如何通过绘制操作创建该图像进行艺术上的理解。

So to answer your question: The most simple approach is to store this kind of, well whatever it is, as a vector graphics (SVG), and draw it using a library that provides drawing from a file. 因此,回答您的问题:最简单的方法是将这种形式以及任何形式存储为矢量图形(SVG),然后使用提供文件图形的库进行绘制。

The choice between CoreGraphics and OpenGL should be based on what your application does primiarily: Is it rendering some 3D graphics, a custom written 3D engine maybe: Use OpenGL. 在CoreGraphics和OpenGL之间进行选择应基于您的应用程序主要要做的事情:是否渲染某些3D图形,定制的3D引擎可能是:使用OpenGL。 If you're aiming to draw some kind of UI then CoreGraphics probably is the better choice. 如果您打算绘制某种UI,那么CoreGraphics可能是更好的选择。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM