In Cocos2d-iphone 3.4 I want to draw a bezier curve and be able to manipulate it by dragging points on it.
It looks like in previous versions of Cocos2d I would have used: ccDrawQuadBezier
ccDrawCubicBezier
ccDrawCatmullRom
ccDrawCardinalSpline
These don't appear to be available in Cocos2d 3.4
Related
i am new opengl learner. i know there is build in function to draw cylinder in glut something like
GLUquadricObj *quadratic;
quadratic=gluNewQuadric();
gluCylinder(quadratic,0.6f,0.6f,1.5f,20,20);
However, is there any other way to draw cylinder using glBegin(GL_POLYGON) and glvertex3d, i am not quite clear about the algorithm behind, please help.
Use sin/cos to trace around a circle in segments. Extend those segments upwards with 2 triangles. Then connect them to close the ends.
You may be able to find the source online for freeglut. Here's some Java code I found: http://massapi.com/source/lwjgl-source-2.7.1/src/java/org/lwjgl/util/glu/Cylinder.java.html
I want to draw a simple Bézier curve (4 control points) with GLUT in a 3D scene. Now I want to duplicate it, then use quads or polygons to join points from the two curves in order to make a surface.
So to achieve this, I think that I need a way to get some coordinates of the Bézier curve.
How can I get them?
Just to make myself clear, I'm trying to draw a 3D surface based on a Bézier-curve.
Or is there any other way to achieve this?
I found a method to convert a Hermite curve into Bezier curve, but is there a similar method to convert a Hermite surface into a Bezier surface that I can use with OpenGL?
OpenGL just draws stuff. It's not a geometry library. You can use OpenGL evaluators to draw those bezier curves/patches you obtained, if using OpenGL<3. With OpenGL-3 and onward you'll have to implement bezier tesselation yourself, though it's easy enough, and can be done very well in a vertex or geometry shader.
I want to render a fire effect in OpenGL based on a particle simulation. I have hundreds of particles which have a position and a temperature (and therefore a color) as well as with all their other properties. Simply rendering a solidSphere using glut doesn't look very realistic, as the particles are spread too wide. How can I draw the fire based on the particles information?
If you are just trying to create a realistic fire effect I would use some kind of re-existing library as recommended in other answers. But it seems to me you that you are after a display of the simulation.
A direct solution worth trying might be replace your current spheres with billboards (i.e. graphic image that always faces toward the camera) which are solid white in the middle and fade to transparent towards the edges - obviously positioning and colouring the images according to your particles.
A better solution I feel is to approach the flame as a set of 2D Grids on which you can control the transparency and colour of each vertex on the grid. One could do this in OpenGL by constructing a plane from quads and use you particle system to calculate (via interpolation from the nearest particles you have) the colour and transparency of each vertex. OpenGL will interpolate each pixel between vertexes for you and give you a smooth looking picture of the 'average particles in the area'.
You probably want to use a particle system to render a fire effect, here's a NeHe tutorial on how to do just that: http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=19
I am doing a snake and ladder game in VC++ using opengl.
I think i can draw a snake using arc and line. But i don't have an idea of how to do it in opengl. Can anyone give me some guidance?
Arc must be broken into small line segments manually. GL can render points, lines, triangles, quads and polygons only.
You might want to take a look at spline interpolation, e.g. Bezier splines, B-splines etc.