Sign in to follow this  
daniel98mex

OpenGL 2D opengl optimization and solution problem

Recommended Posts

Hello to everyone… I’m thinking of doing a program like adobe Photoshop but a little bit different. Ok, this is what I’m searching for… (Speed in 2D) 1. When I’m doing a 2d line in opengl, I can set the original and end point colors. Then the graphic card will do a linear interpolation of the color, but how can I set my own function for each pixel of the line? The only way I know is draw the line using a point function but it will take a lot of processing power of the CPU and it will be too slow. I think if you start a 2d line in opengl the cpu will only tell the graphic card where to start and end the line...(I might be wrong about this). 2. What is the fastest way to create a curve in opengl? (Do I do it with lines? Cause I tried to do the curve by dots but is too slow and it has like 3 pixel of width.) Ok, I have lots of questions left over but I will try to solve them by myself, meanwhile can someone provide me any information of this? Thanks in advance!

Share this post


Link to post
Share on other sites
There is no need to write a shader to make a line which varies in colour along its length.

Just use a texture. You can use a 1d texture - which will do what you want.

Mark

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
thanks alot lightbringer, you are right I need the fragment shader program...

the reason why I want to have shaders its because I don't want to use textures at all...

One more thing... to do polygons can I use this shading method too?

Share this post


Link to post
Share on other sites
You wouldn't actually be using any textures with markr's idea, you would generate a texture procedurally based on the function you want to perform.

As for the second question, I'm not sure what you mean, but I think the concept should translate to two dimensions also.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this