We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

how to modify a jpg image in  opengl.

Medium Priority
564 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
Comment
Watch Question

CERTIFIED EXPERT
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview

Author

Commented:
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?


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.

Author

Commented:
hi

the tutorial was good but i need to use only opengl along with c or c++.
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

Author

Commented:
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?

Author

Commented:
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!!!!!!
CERTIFIED EXPERT

Commented:
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.
CERTIFIED EXPERT

Commented:
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.

Author

Commented:
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
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.
I suggest a split of points between Barthax and myself.
CERTIFIED EXPERT

Commented:
Agreed with satsumo.  (Sorry for the delay.)
Specifically comments #35492358 and #35495348 would be direct answers to the question, the other comments are follow on.
Qlemo"Batchelor", Developer and EE Topic Advisor
CERTIFIED EXPERT
Top Expert 2015

Commented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.