Skip to main content
gamedev.net
🔒 Locked

Gah! Texture problem

Started by FireSlash 2 replies 600+ views
Original Post
FireSlash
FireSlash
For some reason, the texture in this code does not properly show. It gets mapped out in a radial pattern, like spokes in a wheel almost. Any ideas? It''s driving me insane.
GLvoid BuildMapList()
{
 int xloop, yloop;
 glLoadIdentity();
 GLfloat floatx, floaty, floatxB, floatyB;
 MapList=glGenLists(1);
 glBindTexture(GL_TEXTURE_2D, texture[0]);
 glNewList(MapList,GL_COMPILE);			// New Compiled box Display List
  //glBegin(GL_QUADS);
  glBegin(GL_LINES);
   for (xloop=1;xloop     
                        
rodzilla
rodzilla
Hi !

Not sure, but you''re trying to apply a 2d texture on a terrain, right ?
I guess you should be using glTexCoord2f(floatx, floaty) once per vertex (before each glVertex3f statement).

BTW, you should consider using triangle strips instead of quads.
SaM3d!, a cross-platform API for 3d based on SDL and OpenGL.The trouble is that things never get better, they just stay the same, only more so. -- (Terry Pratchett, Eric)
Luya
Luya
Reading the code, textures, quads and colars are in commentary so they won't be compiled. I think the right code should be like:

glVertex3f(float(xloop/xyScale),float((yloop+Detail)/xyScale),float(hmap(xloop,yloop+Detail)/zScale));

glVertex3f(float(xloop/xyScale),float(yloop/xyScale),float(hmap(xloop,yloop)/zScale));

glVertex3f(float((xloop+Detail)/xyScale),float((yloop+Detail)/xyScale),float(hmap(xloop+Detail,yloop+Detail)/zScale));

glVertex3f(float((xloop+Detail)/xyScale),float(yloop/xyScale),float(hmap(xloop+Detail,yloop)/zScale));


Note that I only use LINES just for wireframe so I may mistake as I don't know to texture them yet.


[edited by - Luya on January 22, 2003 1:51:05 PM]
FireSlash
FireSlash
thanks rod.

I''m not concerned about the performance issues of using quads, This project wont be used for anything off this system.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.