Jump to content
  • Advertisement
Sign in to follow this  
nickme

Opengl: is gltexcoord1d() deprecated?

This topic is 735 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

hi

 

I created a program back in 2012, it ran fine.  Recently, i try to rebuild it in VS 2015.  maybe because the gltexcoord1d was deprecated that the color that the the 1d textures did not change.  It is a dark green color, which is not in my raw file.

 

part of the program can be seen below:  

 

 
void World::plotDot(GLint x, GLint y, int c)
{
      glTexCoord1i(c % max_palette_size);
      glBegin(GL_POINTS);
          glVertex2i(x, y);
      glEnd();
}
 
void World::display_fractal(GLuint id)
{
int c, iy = wbottom;
     GLdouble x;
 
     glEnable(GL_TEXTURE_1D);
     glBindTexture(GL_TEXTURE_1D, id);
     glPointSize(1.0);
     for (GLdouble y = b; iy >= wtop; iy--, y += deltay) {
     x = lMsX;
           for (int ix = wleft; ix <= wright; ix++, x += deltax) {
                plotDot(ix, iy, c=compute(x, y));
           }
     }
     bDisplayed = true; // so it need not recalc when not in refresh
     glPointSize(4.0); // for debug:try to display what is in the texture id.
     for (int x = 0, c = 0; c < max_palette_size; x+=4, c++) {
          plotDot(x, 700, c);
     }
     glFlush();
}
 
i know that i used a lot of api calls to render a whole screen of pixels.  I eventually will use VBO and GLSL, but i want to fix this problem first.
 
can anybody know what is the problem or suggestion for what to look for?
 
thanks in advance.

Share this post


Link to post
Share on other sites
Advertisement

Put glTexCoord inside glBegin/glEnd and before glVertex.

 

 

glTexCoord1i(c % max_palette_size);
      glBegin(GL_POINTS);
          glVertex2i(x, y);
      glEnd();

Share this post


Link to post
Share on other sites

Put glTexCoord inside glBegin/glEnd and before glVertex.


That should not really be the problem, glTexCoord can be called at any time since it just modifies state. glVertex* is only allowed to be called inside glBegin/glEnd.

That said, glTexCoord is just severely, extremely deprecated. You could try to fix it. Try glTexCoord2f instead of glTexCoord1d since that was much more used even back then and maybe the emulation for the very uncommon functions got broken in a driver update. I highly doubt that though. It's far more likely your program relied on undefined behavior of OpenGL and the behavior changed in newer drivers.
It's also possible that whatever you are using to create the OpenGL context requests a context without the deprecated functions.

Personally, I would not bother to fix it. The old deprecated functionality of OpenGL is very useless. Both from a performance point of view as well as from a learning point of view. The way you would do these things now is just very different.

Share this post


Link to post
Share on other sites

 

Put glTexCoord inside glBegin/glEnd and before glVertex.


That should not really be the problem, glTexCoord can be called at any time since it just modifies state. glVertex* is only allowed to be called inside glBegin/glEnd.

You're right. I did never know that it could stand out of the Begin/End statement. But this has some relevance only when rendering points (which is indeed what the OP is currently doing).

Share this post


Link to post
Share on other sites

hi guys
 
I would appreciate if you guys talk to me rather than among yourself.


Unfortunately that's not how forums work. As long as they don't veer too far off topic or derail the thread (they haven't), there is nothing wrong with posts that don't specifically address you.

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!