View Full Version : 2D Paint program advice?
04-16-2003, 02:24 PM
I want to create something similiar to a 2D Paint program using OpenGL. At this stage I see two options:
1) Paint with glDrawPixels
2) Use a texture on a quad which fills the screen, and paint with glTexSubImage2D.
I think both techniques would need an orthographic projection.
Mainly I'm worried about how fast or slow these methods would be. I'd like to implement things like airbrush or spraycan drawing. Maybe selection, too.
04-16-2003, 06:52 PM
Why do you want to do this? a) why implement a paint program at all as there are already so many around and b) why do this with OpenGL?? If you want to paint onto a texture, you can more easy do this with cgi/canvas/whatever methods and copy this to a texture image?
04-17-2003, 01:47 AM
Originally posted by JanHH:
Why do you want to do this?
Number one reason: to learn OpenGL.
a) why implement a paint program at all as there are already so many around, (b) why do this with OpenGL??
Well, as my initial post states, I want to "create something similiar to a 2D Paint program" -- I'm not actually creating a 2D paint program. What I'm creating is a terrain sculpting program specifically for a certain 3D racing game. You would sculpt the terrain in 2D mode using its greyscale heightmap, and then view it in 3D mode. Since I'm doing all this in the same window (you toggle between 2d and 3d mode) I figure why not stay in OpenGL mode (and perhaps take advantage of some of its features) when I'm sculpting the terrain, and not just when I'm in viewing mode?
If you want to paint onto a texture, you can more easy do this with cgi/canvas/whatever methods and copy this to a texture image?
Yes, I've already done this. But I'd like to learn about manipulating pixel data with OpenGL. Or perhaps using a texture and glTexSubImage2D. So I was just looking for advice on which would be better.
[This message has been edited by cragwolf (edited 04-17-2003).]
04-17-2003, 02:53 AM
I think for your application both methods would suffice (you do not need 110% performance out of your card, since it's probably faster than most people can draw anyway).
I usually prefer to use textures, since it gives you more options for manipulation (scaling, rotation, coloring, and other interesting fragment/framebuffer operations). It may be tedious to setup the projection etc though, and if you need a large texture (larger than what your OpenGL implementation supports), you may need to split the image into several textures.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.