Jump to content
  • Advertisement

Archived

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

sdlprorammer

Rotating a triangle in SDL

This topic is 5138 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 want to write a single program on rotating a triangle. The trinagle will also be filled with a color, or with many colors. How do i go about it? Am i going to keep drawing the triangle pixel by pixel? And the movement is also hard.. PLEASE help

Share this post


Link to post
Share on other sites
Advertisement
Why not use OpenGL?

SDL has support for OpenGL integration, so this would be a breeze. There''s little sense in reinventing the wheel, unless this is for the sake of learning how 3D works.

Share this post


Link to post
Share on other sites
Yeah it sounds as if you try to learn SDL by reading tutorials about opengl or directx.
SDL is meant for sprites. For example: why would you want to rotate triangles in a 2d tile based game?

You can rotate sdl surfaces using an additional library though.
http://www.ferzkopp.net/~aschiffler/Software/SDL_gfx-2.0/

But if I were you I''d approach learning differently.
You can''t start a new thread for each function of SDL here ...

Share this post


Link to post
Share on other sites
It's not 3D. It's only 2D. I want to rotate from the center ( only a point ).I know how to move a sprite in the screen, but rotating the triangle is a little harder.. So?

P.S RuneLancer could you show me some functions.. ( without pure SDL, with OpenGL too - just too have a look at them )?

>You can't start a new thread for each function of SDL here ...
I am sorry but i am a beginner in graphics, and, i know.... every beginning is hard so bear with me...

[edited by - sdlprorammer on May 27, 2004 9:38:17 AM]

Share this post


Link to post
Share on other sites
Perhaps it would be wise to have a look at the SDL documentation that came with it? I learned everything I know about SDL from them, really; it's not too hard.

As for OpenGL functions, there's hardly any point in showing you example functions if they're taken out of context: it's a little hard to understand what the use of toying with the projection matrix is without explaining what the projection matrix is and what it's for, and how it affects an OpenGL scene as a whole. What you're looking for is a tutorial, pretty much. May I suggest having a look at NeHe? They have pretty good stuff to get you started.

On the subject of you asking so many questions about SDL, have you tried experimenting with these functions? A first-hand look at what happens when you use something can often be very insightful and could solve a lot of the questions you have. You can't expect to have the answer to everything spoon-fed to you when it comes to programming. And it'll make Clueless a happy man.

[edited by - RuneLancer on May 27, 2004 10:03:33 AM]

Share this post


Link to post
Share on other sites

RuneLancer, if you read my posts, you''ll see that i do read the docs, and that i do expirement.

Anyway, on the topic, why would i go on OpenGL when what i want is 2D? Please let''s leave OpenGL alone right now. Can anybody please give me some notes on how to implement what i need?

Share this post


Link to post
Share on other sites
I didn't write it because it is annoying.
With so many questions about specific functions ...
I think it is a better understanding of the big picture that would really help.
Read in the gamedev articles.
Look at SDL example programs.
Look at OpenGl example programs.
Read threads about 2d and 3d programming.

Looking at the SDL documentation alone does not make sense at that stage IMO.

Why would anybody want to rotate a triangle (why triangle???) in SDL?

[edited by - Clueless on May 27, 2004 10:23:44 AM]

Share this post


Link to post
Share on other sites
ah.... Well if i am going to download a library for that stuff ( which as i understand shouldn''t be done with SDL ), and one just for writting text in the screen, then why don''t i just drop SDL and start OpenGL, witch with i can do everything SDL supports?

Share this post


Link to post
Share on other sites
Why do you seem to think SDL and OpenGL are competing libraries. They are not. It''s like saying should I drop bananas in favour of a spoon.
You can quite happily use both together, one, or something different entirely to accomplish similar goals.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!