?
Solved

how to modify a jpg image in  opengl.

Posted on 2011-04-29
18
Medium Priority
?
507 Views
Last Modified: 2013-11-08
hello
           i am an engg student. i have taken up a project of designing a bow and arrow game wherin the archer will be shooting the arrow and the arrow will move to the other end.

now i know how to load the image using texturing and also collision detection but

i don't know how to modify the image.

in the attachement that i have uploaded the archer is in an aiming position. Now if i press a key (say Enter) then the same arrow in the image has to move towards right and also the hands of the archer must come down once the arrow is shot.

It would be of a remarkable help for me if you could do this above functionality.
Pls kindly Help!


regards
manikandan
images.jpg
0
Comment
Question by:manikandan689
  • 6
  • 5
  • 4
  • +1
16 Comments
 
LVL 19

Accepted Solution

by:
Barthax earned 1000 total points
ID: 35492358
Traditional display logic is to have multiple pictures - one per animation frame.  Paint the original picture on screen and then supplant the area of the first image with the second in the animation and cycle through to the final frame (no arrow pictured at all).

If you have a background image which is not a part of your animation, then you will need to get into masks
0
 
LVL 12

Assisted Solution

by:satsumo
satsumo earned 1000 total points
ID: 35495348
As Barthax say, this requires frames of animation.  Also consider that the arrow might have to move under the control of the program once it leaves the bow, in which case you will need a separate image of the arrow that can be moved independently.

To actually change the image you would need to edit it in Photoshop, Gimp or a similar image editor.  You might find it easier to do the animation if you recreate the image in a drawing application (Illustrator, Corel Draw, Inkscape).
0
 

Author Comment

by:manikandan689
ID: 35495642
HELLO
               Thanks for your advice.Now i have created 3 bitmap images.

1. the archer aiming position
2. the archer position
3. the arrow

but i am not getting the idea how to move the arrow towards the other end of the screen using animation.

Can you suggest a simple book or tutorial on  animation?


0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 12

Expert Comment

by:satsumo
ID: 35496906
The details vary according to what OS, hardware and APIs you use.  Many people use SDL the first time doing something like this.  This is the clearest tutorial I could find http://cone3d.gamedev.net/cgi-bin/index.pl?page=tutorials/gfxsdl/index.  Although the tutorial is about SDL, the principles are the same whatever system you use, you should be able to adapt it if needed.
0
 

Author Comment

by:manikandan689
ID: 35497218
hi

the tutorial was good but i need to use only opengl along with c or c++.
0
 
LVL 12

Expert Comment

by:satsumo
ID: 35497537
OK, but then the details depend on the OS.  It needs a periodic update loop, it needs to update an area of the display, handle input etc.  These are some relevant links without SDL. The second one is very comprehensive, perhaps a bit too much so.

http://www.gamedev.net/page/resources/_/reference/programming/opengl/269/rendering-efficient-2d-sprites-in-opengl-using-texture-rectangles-r2429
http://www.yagudaev.com/programming/cc/16-2d-sprites-in-opengl
0
 

Author Comment

by:manikandan689
ID: 35499408
hello,

                         i need to draw balloons(ellipses of red color) and make them to move  in the vertical direction. The amount of balloons must be drawn randomly but at a time there shouldn't be more than 10 balloons.


can any one help me in coding?
0
 

Author Comment

by:manikandan689
ID: 35500576
hello

                   i came to know how to draw balloons. but

i need to move multiple balloons  in the vertical direction one behind the other simultaneously.

Please help!!!!!!
0
 
LVL 19

Expert Comment

by:Barthax
ID: 35689763
This sounds very much like homework. ;)

If you know how to draw a balloon, drawing many balloons at different co-ordinates it just a matter of changing where you start to draw it.  As for animating them moving, you should have a background picture or colour: first draw over the existing balloon with the background and then draw the balloon after moving it a little up the Y axis.
0
 
LVL 19

Expert Comment

by:Barthax
ID: 35689806
Note that in this basic premise for animation, the order you draw the balloons will determine which one sits on top of the others.  This is the "Z" axis of your screen - how deep "into" the screen you go.
0
 

Author Comment

by:manikandan689
ID: 35727046
HELLO,

i need to display a variable in opengl.

i use glut to print strings using  bitmapcharacter but i am not able to display a integer variable.


pls help
0
 
LVL 12

Expert Comment

by:satsumo
ID: 35727093
If you can render strings, just write the integer to a string and render that? itoa() or sprintf() will write an integer to a string.
0
 
LVL 12

Expert Comment

by:satsumo
ID: 35908221
I suggest a split of points between Barthax and myself.
0
 
LVL 19

Expert Comment

by:Barthax
ID: 35957147
Agreed with satsumo.  (Sorry for the delay.)
0
 
LVL 12

Expert Comment

by:satsumo
ID: 35957959
Specifically comments #35492358 and #35495348 would be direct answers to the question, the other comments are follow on.
0
 
LVL 71

Expert Comment

by:Qlemo
ID: 35994313
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently, in one of the tech-blogs I usually read, I saw a post about the best-selling video games through history. The first place in the list is for the classic, extremely addictive Tetris. Well, a long time ago, in a galaxy far far away, I was…
Arrow Electronics was searching for a KVM  (Keyboard/Video/Mouse) switch that could display on one single monitor the current status of all units being tested on the rack.
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
Suggested Courses

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question