Jump to content

View more

Image of the Day

WIP title screen for #DeathOfAPartisan #screenshotsaturday #gamedev https://t.co/qJNhfZCvd4
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

opentk:texcoord1 cant produces colors.

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
No replies to this topic

#1 nickme   Members   

253
Like
0Likes
Like

Posted 26 December 2012 - 02:56 PM

hi

 

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);
            else 
                GL.Color4(1.0, 1.0, 1.0, 1.0); 
        }
 
        private void plotDot(double x, double y, int c)
        {
            GL.Begin(BeginMode.Points);
                GL.TexCoord1((double)c / (double)maxIter);
//                setColor((double) c / (double) maxIter);
                GL.Vertex2(cx(x), cy(y));
            GL.End();
 
        }
 
        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.Clear(ClearBufferMask.ColorBufferBit);
            GL.ClearColor(Color4.Gold);
 
            GL.Disable(EnableCap.Texture2D);
            GL.Enable(EnableCap.Texture1D);
            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);
            GL.Disable(EnableCap.Texture1D);
        }
 





Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.