PDA

View Full Version : Graphics Libs for Dev-C++??


MattTheMan
02-18-2006, 02:34 PM
The question is, for my raytracer, I need a graphics library for Dev C++. I need one that can support 800 by 600 windows and I need it to be fairly easy to use.

Anyone wants to help?

Thanks in advance
Matt

tciny
02-18-2006, 02:55 PM
wxWidgets?

mummey
02-18-2006, 03:03 PM
It sounds like you mean an API for a Graphical User Interface. This is not the same as a graphics API.

MattTheMan
02-18-2006, 03:31 PM
No, I dont need GUI.
All I need is something that can display colors on a window, so my raytracer produces an image I can see :p

mummey
02-18-2006, 06:03 PM
No, I dont need GUI.
All I need is something that can display colors on a window, so my raytracer produces an image I can see :p

Yes, you already stated this, a window is part of a gui. :p

MattTheMan
02-19-2006, 01:04 AM
Lol, sorry, i dont know these things... im only 14 :p

BlueTide
02-19-2006, 04:09 PM
No, I dont need GUI.
All I need is something that can display colors on a window, so my raytracer produces an image I can see :p

SDL is a nice choice for many. I personally use Dev-C++ with it (from the packet manager it has) together with OpenGL and a few other libs. Latest version from the packet manager did not work, but one below that feels smooth.

mummey
02-19-2006, 05:55 PM
Sounds like you need something simple. FLTK isn't, but may fit your needs.

http://www.fltk.org/

This may help too.
http://graphics.cs.uiuc.edu/~garland/software/libgfx.html

MattTheMan
02-19-2006, 10:06 PM
thanks guys, but so far none of those has worked.

Do you know any one that is super simple and that I can just add to includes and it works?

Again, all I need is something that can display pixels on a screen.

THanks in advance
Matt

mummey
02-19-2006, 10:33 PM
Mac/Win/or Lin?

tciny
02-19-2006, 10:51 PM
Visual Basic? ;)

btw.: I think you should learn the C++ language itself first before attempting to pull off stuff like a raytracer. It'll be frustrating otherwise...

MattTheMan
02-19-2006, 11:58 PM
mummey: Win32- anything for Win32


tciny: i know c++ well enough. My program works. My raytracer works. It gets the color for each pixel in x and y coordinates. Ii unfortunayle cant desplay them without a good lib!

cignox1
02-20-2006, 07:40 AM
If you only need to show a window, you don't need a GUI system. Use Allegro or SDL (SDL is a bit more easier to use): in both cases you will have a windows in less that a dozen of line (of course, I suppose that you use c or c++).
If you go with sdl, it has not putpixel function built in, but in the documentation they provide one (I tell you that because I spent a couple of days looking for such a function).
You can find it on www.libsdl.org
Give also a look to all the libraries available for sdl: some of them let you use fonts (in case you need to display some informations) or load images (useful if you want a fast and easy way to start with textures or backgrounds).

mummey
02-20-2006, 12:19 PM
Since you're just looking for something to display images, this may do the trick.

http://www.imagemagick.org/script/index.php

Its an image suite, but its free and they also set up the code so you can use it in your own applications.

MattTheMan
02-20-2006, 02:17 PM
ok so I added all of the SDL library stuff to my dev-C++ include file and when I add the

#include "SDL.h"

to my raytracer, it says:

Undefined reference to WinMain@16

And it won't compile.

i wish c++ had a built in graphics system...

Do you think I could cheive the pixel color with the standard

<windows.h>

library?

The guy that wrote the flipcode tutorials on raytracing certainly managed to!


Thankls so far
Matt

tciny
02-20-2006, 03:58 PM
You could use CreateWindowEx to create your window and then use GDI/GDI+ to draw to the windows context but I dont think thats nearly as easy as you'd want it to be.
Especially since the safe methods of writing per pixel such as SetPixel are extremely slow and the techniques using Bitmaps, locking them and writing directly to their memory arent really what one would call straight forward.

MattTheMan
02-20-2006, 04:52 PM
I really don't mind slow, but I would appreciate something simple that I can just move some files and it works... I just want to be able to make my raytracer make an image ! :(

mummey
02-20-2006, 06:03 PM
I really don't mind slow, but I would appreciate something simple that I can just move some files and it works... I just want to be able to make my raytracer make an image ! :(

I'm assuming that you are already writing the image out to a file. Would I be correct in assuming that?

MattTheMan
02-20-2006, 07:30 PM
no... I am not. I wish I could know how to though!

I willl do a google search. No, what I am doing is, the computer is doing the render, but instead of making an imag appear in the window, which I want it to do, I make it cout each color at each pixel.

I downloaded PNG writer, and hopefully I can run that, make it save images as a .png and open them with photoshop to view them... hopefully

mummey
02-20-2006, 08:38 PM
no... I am not. I wish I could know how to though!

I willl do a google search. No, what I am doing is, the computer is doing the render, but instead of making an imag appear in the window, which I want it to do, I make it cout each color at each pixel.

I downloaded PNG writer, and hopefully I can run that, make it save images as a .png and open them with photoshop to view them... hopefully

That's one method. There's also:

libtiff (http://www.libtiff.org/)
libjpeg (http://www.ijg.org/)
libpng (http://www.libpng.org/pub/png/libpng.html)

or some other image library. Writing to a file is MUCH easier than writing it to the screen. Heck you could even write it out as a binary or ASCII RGBA file with no compression at all and some programs will read it.

nurcc
02-20-2006, 08:40 PM
no... I am not. I wish I could know how to though!

I willl do a google search. No, what I am doing is, the computer is doing the render, but instead of making an imag appear in the window, which I want it to do, I make it cout each color at each pixel.

I downloaded PNG writer, and hopefully I can run that, make it save images as a .png and open them with photoshop to view them... hopefully

If you just want to be able to output images, probably the simplest format is PPM. It's bloated, and not very well supported, but it sure is simple. IrfanView can view it/convert it.

Here's a simple class you can use to read/write ppms (http://rivit.cs.byu.edu/655/codeSnipets/codeSnipets.html). It should compile fairly easily. And you've got all the code, so if it doesn't work, you can trace through it.

MattTheMan
02-20-2006, 09:11 PM
nurcc- It gives the horrible error "Undifined Reference to WinMai@16"

Its a linker error, and if I were to know what that means.. that would help >.<

edit: i solved it by adding in the linker:

WinMain@32

there was nothing else in it, but that seemed to leave the only thing left (error wise) as a build error... crap it wont work...

And how would I install those png, jpg, and tiff writers? This is really ticking me off, me not being able to do this!

thanks anyway
MAtt

UrbanFuturistic
02-21-2006, 12:15 AM
I think this should help you get started (http://lazyfooproductions.com/SDL_tutorials/index.php).

jamacsween
02-21-2006, 12:12 PM
Hi MattTheMan,

Sounds like you know enough C++ to get the core functionality of your engine working but are falling down on the windows managment side.

Can I suggest you bag DevC++ and just go for Express version of Visual C++ (free download but big) or get an old copy of borlands C++Builder from ebay (quick search shows version 3 and 4 available for around $10).

This removes the hassle of GUI development and lets you enjoy writing the code, your code not worrying about how to get a button or image on the screen. Help file and components that let you call functions such as TImage->Pixel[i][j]=Color... etc.

Cheers

JA

PS if you end up with C++Builder (what i use) drop me a line if you need more help.

MattTheMan
02-21-2006, 11:00 PM
thanks guys- I think my dad has Visual c++ and I'll try to get that.

My code will work with that right? I mean, the libs I use are

<stdlib>
<math.h>
<iostream>

Those would work in visual c++ too right?

Thanks for the link though odubtaig... I'll do my best

cya later
Matt

jamacsween
02-22-2006, 10:06 PM
Hi there,

Yeah visual c++ should be fine. Really suggest you get the free express version. Bang up to date then.

Those libs should be fine. They do the non-visual stuff for you anyway.

HTH


JA

Robert Bateman
02-23-2006, 01:31 PM
nurcc- It gives the horrible error "Undifined Reference to WinMai@16"

this is because you are trying to compile a Win32 console app as a full blown windows App. Under Win32 you need WinMain, not main!

Seriously, if you just want a window, use glut. See the opengl stuff on my website for that. As for images, use devil - it handles most file formats in a single easy to use lib. I wouldn't use libTiff etc directly.

On my site, there is also a screenshot example in the openGL section that shows you how to save images as tga....

Robert Bateman
02-23-2006, 01:35 PM
thanks guys- I think my dad has Visual c++ and I'll try to get that.


get visual C++ express 2005 (free download) :

http://msdn.microsoft.com/vstudio/express/visualc/

Then install the latest Win32 platform SDK :

http://www.microsoft.com/downloads/details.aspx?FamilyId=A55B6B43-E24F-4EA3-A93E-40C0EC4F68E5&displaylang=en

MattTheMan
02-25-2006, 05:27 PM
Thanks everyone: I managed to set up the SDL library and with QuickCG, I am able to see what my raytracer does. Thanks everyone.

CGTalk Moderation
02-25-2006, 05:27 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.