Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Visible Stink
Mar 31, 2010

Got a light, handsome?

I agree. I am just starting out on learning OpenGL and am making a terrain generator (bit more interesting than starting with rotating cubes) and wanted to draw a set of axis in my scene. I used glBegin/glEnd because I didn't want to bind buffers and set up shaders just to draw 3 loving lines. I figure it may be slower than the alternative but it me saved a lot of effort and should it cause me problems later on I'll deal with it then.

As I said I'm still a novice to this so if I said something dumb please correct me.

Adbot
ADBOT LOVES YOU

Visible Stink
Mar 31, 2010

Got a light, handsome?

Try setting your texture parameters after binding your texture, like this:
code:
	glGenTextures(1, &TEX_NAME);
	glBindTexture(GL_TEXTURE_2D, TEX_NAME);
	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, WIDTH, HEIGHT, 0, GL_RGBA, GL_UNSIGNED_BYTE, tex_data);

	// Prepare texture-related nonsense
	glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
	glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);

	glutMainLoop();
I can't give you any reason why this should make a difference but it worked for me on my machine (Windows 7 64 bit, Visual Studio 2010).

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply