Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

leehairy

OpenGL 4 OpenGL Questions

This topic is 5886 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I started using opengl last night so i am VERY inexperienced and soem of these questions may seem silly. I have managed to draw and move some textured objects around a background.. However.. i have a few simple questions 1) In every redraw do i have to .. a) bind a texture b) regenerate a quad (at the correct place) or can i a) bind the texture once at initialisation b) use the bound texture by name or something else c) just translate the stored quad instead of redrawing at the correct place What is the best method of reproducing blitted sprites?? 2) I tried spinning the textured quad around its centre point .. However it always spun around its top left when i created it using (0,0) (0, 128), (128,128), (128,0) .. so to get the quad to rotate around its centre point i created it so that (0,0) was at its centre as in (-64, -64), (64,64), (-64,64), (64,-64).. Does glRotatef() rotate an object around (0,0) or am i missing the point entirely ? 3) Usually when i do any 2D graphics i have to manually maintain a list of dirty rectangles for blitting. Do i need to bother with this when using OpenGL? Should i just manually clip all objects that fall outside the scene and just redraw every object? What are the generice techniques used? 4) Do i only get hardware acceleration when using OpenGL in fullscreen mode ? Thankyou in advance for any help and suggestions..

Share this post


Link to post
Share on other sites
Advertisement
1 - If you are only using one texture then you could bind it at initialisation, but you would have to draw it every frame (translating only changes where things are going to be drawn, not the position of things that have been drawn)

2 - Opengl rotates around whatever the current center point is, when there have been no translations this is (0,0) but if you translate by (10,5) then the new center point is (10,5) and opengl will rotate around that.

3 - Not really sure about this, I dont use opengl for 2d, sry.

4 - No you can get hardware acceleration in a window

Hope I helped

Share this post


Link to post
Share on other sites
2 - u should read about the different kinds of martixs OpenGL has,what the matrix stack is, how to use it and how transformations work.

From the redbook:
Thinking about Transformations
Let's start with a simple case of two transformations: a 45-degree counterclockwise rotation about the origin around the z-axis, and a translation down the x-axis. Suppose that the object you're drawing is small compared to the translation (so that you can see the effect of the translation), and that it's originally located at the origin. If you rotate the object first and then translate it, the rotated object appears on the x-axis. If you translate it down the x-axis first, however, and then rotate about the origin, the object is on the line y=x, as shown in Figure 3-4. In general, the order of transformations is critical. If you do transformation A and then transformation B, you almost always get something different than if you do them in the opposite order.

Heres an image that explains it:
http://ask.ii.uib.no/library/SGI_bookshelves/SGI_Developer/books/OpenGL_PG/figures/chap3-9.gif

[edited by - Jonus on August 14, 2002 7:33:56 AM]

Share this post


Link to post
Share on other sites
3/dont clip anything (let the hardware do it) u will want to cull things (not send them to opengl) though if the fall completely ouside the window

http://uk.geocities.com/sloppyturds/gotterdammerung.html

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!