Advertisement

texture mapping?

Started by January 24, 2003 03:22 PM
5 comments, last by Steelrose 22 years, 1 month ago
Here''s a simple one. I think I already know the snswer but I want to verify it so I''m not wrong. Can you mix textured and non textured parts of the same object within a GLlist? Here''s an example: start list textured part non textured part non textured part end list
Dreams arn't just dreams, They're a whole new world to play in.
yes, you can

start list
enable texturing
bind texture
draw textured part(s)
disable texturing
draw untextured part(s)
end list

You should never let your fears become the boundaries of your dreams.
You should never let your fears become the boundaries of your dreams.
Advertisement
I tried that and it doesn't seem to want to work.

Here is the entire piece of code that is doing this:
(I hope it prints correctly)

GLvoid Makepart(char *part,int tex = 0)
{
bool ch = false;

BuildItem(part);
ch = SetupSurfaces(tex);
int x=0,l,k,id;
int num = 0;
while(num < polysize ){
l=polylist[num];
id = ptags[x];
if (id>Listsize){
id=0;
}

if (ch){
glColor3f(1,1,1);
glBindTexture(GL_TEXTURE_2D,texture[tex]);
glEnable(GL_TEXTURE_2D); //enable here?
}
else{
glColor3f(List[ id ].colr, List[ id ].colg, List[ id ].colb);
glDisable(GL_TEXTURE_2D); //disable here?
//glColor3f(1,1,1);
}

num++;

glBegin(GL_POLYGON);
for(k=0;k {
if(ch){
glTexCoord2f( (vmaps[ polylist[num+k] ][0]),
(vmaps[ polylist[num+k] ][1]) );
}

glVertex3f(points [ polylist[num+k] ][0],
points [ polylist[num+k] ][1],
points [ polylist[num+k] ][2]);
}
glEnd();

num+=l;
x++;
}

delete polylist;
delete [] points;
delete ptags;
delete List;
delete vmaps;
delete clip;

//z=(float)bbox[2]-10;


}

Oh good it did. Anyway take a look and tell me what you think.

And here are the references:
polylist holds each polygon by storing the vertices in order after it tells how many points are in the polygon
points holds the x,y,z for each point
ptags tells which surface data to use for each polygon
List is the surface listings
vmaps tells where each point is on the texture map
clip holds the directory where the image for the texture is stored
BuildItem up top dissembles the object file and preps it for use
Setupsurfaces after that sets up the surfaces as defined by "clip" and "ptags"

If setupsurfaces returns a true then there was a texture given in "clip" and it was created correctly.

Am I putting this in the correct locations?

Thanks for the help.


(well it kinda printed out correctly)

[edited by - Steelrose on January 26, 2003 1:43:35 PM]
Dreams arn't just dreams, They're a whole new world to play in.
AFAIK you cannot mix textured and non-textures parts in a displaylist. (If you''re not referring to displaylists here... sorry, I misread again )

GL_TEXTURE_2D is an OpenGL state and is not processed as part of a displaylist. The best way around this would be to create 2 lists. One for the textured part and one for the non-textured part. At rendering time do this:

glEnable(GL_TEXTURE_2D);
glCallList(texturedpart);
glDisable(GL_TEXTURE_2D);
glCallList(untexturedpart);

Good luck!


Sander Maréchal
[Lone Wolves Production][Articles][GD Emporium][Webdesign][E-mail]

<hr />
Sander Marechal<small>[Lone Wolves][Hearts for GNOME][E-mail][Forum FAQ]</small>

So it''s either all or nothing,huh? I was afraid of that. Oh well, i guess I''ll have to create texture maps for everything. I just didn''t want to do that now. Thanks again guys.
Dreams arn't just dreams, They're a whole new world to play in.
Bit of mis-information there...it is acceptable to have GL state changes from within a display list (just make sure anything you enable gets disabled otherwise it will affect polys after the list is called), however there are functions which you cannot use within display lists such as vertex pointer stuff etc.


Advertisement
In what way do you mean?
Dreams arn't just dreams, They're a whole new world to play in.

This topic is closed to new replies.

Advertisement