Jump to content
  • Advertisement
Sign in to follow this  

opentk:texcoord1 cant produces colors.

This topic is 2120 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 wrote a program that uses texture1d as palette for my fractals.  when i use the GL.Color4(), it show the desired image, but when i use texcoord1(), it just show a black screen.  here is a snippet of code that show where my codes to draw to the window.  


the bmp file that the loaded as a palette was called somewhere else.  the textureid was past to this class by program.cs.



        private void setColor(double c)
            if (c >= 0.9)
                GL.Color4(1.0, 0.0, 0.0, 1.0);
            else if (c >= 0.8)
                GL.Color4(0.0, 1.0, 1.0, 1.0);
            else if (c >= 0.70)
                GL.Color4(1.0, 1.0, 0.0, 1.0);
            else if (c >= 0.50)
                GL.Color4(1.0, 0.0, 1.0, 1.0);
            else if (c >= 0.4)
                GL.Color4(0.0, 0.0, 1.0, 1.0);
            else if (c >= 0.30)
                GL.Color4(0.0, 1.0, 0.0, 1.0);
            else if (c >= 0.2)
                GL.Color4(0.0, 0.0, 0.0, 1.0);
                GL.Color4(1.0, 1.0, 1.0, 1.0); 
        private void plotDot(double x, double y, int c)
                GL.TexCoord1((double)c / (double)maxIter);
//                setColor((double) c / (double) maxIter);
                GL.Vertex2(cx(x), cy(y));
        int compute(double x, double y)
            if (func == function.julia)
                return Julia(x, y);
            return Mandelbrot(x, y);
        public void display_fractal(int ID)
            GL.BindTexture(TextureTarget.Texture1D, ID);
            for (double y = b; y <= t; y += deltay)
                for (double x = lMsX; x <= r + sX; x += deltax)
                    plotDot(x, y, compute(x, y));
            GL.BindTexture(TextureTarget.Texture1D, 0);

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • 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!