Advertisement

Questions or Three, hope someone can answer

Started by September 25, 2000 10:16 AM
1 comment, last by JizzRoy 24 years, 2 months ago
These are basic questions to most I''m sure.. Ok I have a little program running and I have some textured objects but now I just want to draw regular non-textured stuff again. .how do I ''Unbind'' the textures ? I''ve been working with GLUT, (I couldn''t get it to work so I wrote a function to draw cubes for me) but I wanted to do glutSolidCube(etc..); so that works fine and creates a cube at the right spot for me.. but .. now how do I move it?? i tried translatef and scalef and neither or those would move it or change it''s side.. For now I just have a function with 6 QUADS that works.. would this be faster or glut? Also I want to texture this.. (which I do in my function) .. Another thing.. I was looking through the glu header file and saw Quadrics and gluSphere and stuff.. What is a Quadrics and for the definition of a sphere you need a quadric type.. so how do I define that ? .. I tried but couldn''t get it to work.. Thanks very much!
Well, (it''s a deep subject... {groan} ) do "unbind" a texture, simply bind another texture, or, disable textures all together. For instance, in your program you might have...

glEnable(GL_TEXTURE_2D);

glBindTexture(GL_TEXTURE_2D, texture[0]);

...
draw things
...

glDisable(GL_TEXTURE_2D);

glColor3ub(255, 255, 255);

auxSolidCube(2.0f);

just as an example of how you might bind some textures to some things then draw a solid white cube....

To translate things you have to have keys bound (duh...) and then have it set up so that...

glTranslated(xTrans, yTrans, zTrans);

...
draw things
...

That should do it... Then you want to bind a texture to your cube? Well, (another deep subject... {and another groan} ) you can''t do this with the aux library or the glut library for all I can figure out. This is because it doesn''t have it set to bind the verticies to the texture coords so no texture shows up. To do this, read NeHe''s tut on textures (I think it''s tut 6) and you''ll see the glTexCoord2d(1, 0); or something like that... That means... If it''s (0, 0) bottom left, (0, 1) top left, (1, 0) bottom right, (1, 1) top right. You can use any number between 0 and 1 as well if you have something that doesn''t have square faces...

As far as quadratics go, there is a tut on NeHe''s site, I''m pretty sure, that deals with quadratics, that should give you a basic idea of what they are... They''re just basically spheres, cylinders, and disks... Defining a quadratic sphere requires a variable type of GLUqradricObj... Define it like any other variable. You also have to set the gluQuadricDrawStyle(...), gluQuadricNormals(...), gluQuadricOrientation(...), and gluQuadricTexture(...)... Read about those in MSDN, I think it''s there at least... If you just want a plain old sphere, tho (won''t be textured) just pop this function auxSolidSphere(float radius); into your program and it''ll draw... Not sure of the glut call to draw a sphere since I never learned it. That''s all thanks to NeHe, I might add.

S.
Advertisement
Thank you soooo much if it wasn''t for people like you I''d still be printing lines to a console. thanks again

This topic is closed to new replies.

Advertisement