openGL heart

Started by
9 comments, last by ramzi085 18 years, 3 months ago
Hi all, can anybody tell me how can i draw a heart in openGL??? and i have another question can i take input from users in openGL not from cin statment ???
Advertisement
1) What kind of heart?

2) OpenGL has no functions for user input. The windowing library you use to create the GL rendering context may have functions for accepting user input.
Quote:Original post by ramzi085
can anybody tell me how can i draw a heart in openGL???

Use pixels. I'm sorry, you'll have to be more specific.
Quote:Original post by ramzi085
can i take input from users in openGL not from cin statment ???

OpenGL is a graphics API, it doesn't handle user input. Look into GLUT, DirectInput, or write a routine using something like the GetAsyncKeyState function.
i want to draw a love heart!!
Then you could probably just use an drawing program to draw the heart on an image, save it to a file and load that file as a texture that you use on a quad.
no no no i dont want it from image i want to draw it using GL_POLYGON
Get yourself some graph paper, draw the heart out by hand then translate the co-ordinates from the graph paper into OpenGL co-ordinates, plug them into a list and draw them.
i know that but how can i do the curve in the heart
Computers draw curves by approximating them with a string of very small straight line segments. You can either go the graph paper method and just make sure you plot a vertex often enough that it looks smooth, or you could write yourself a routine that generates points on a curve (for example a section of a circle) using trigonometry or some kind of interpolation, then use that to generate your vertices.
For something quick and simple, the graph paper is your best bet - just use lots of vertices on the curves.
Go to 3D Cafe, select "Free Stuff", agree to the license, select 3D Models, then Anatomy, then scoll down to heart.zip. You can click the little rectangle to the right of the filename to see what it looks like when rendered. One valantines appropriate heart, enjoy.
Keys to success: Ability, ambition and opportunity.

This topic is closed to new replies.

Advertisement