Advertisement

How can I make a sphere in openGL

Started by March 02, 2002 06:07 AM
2 comments, last by Alex2k 22 years, 11 months ago
Hi, could anyone tell make a simple way to make a sphere in opengl? I just need the sintax or something like this (this is for a cube face): glBindTexture(GL_TEXTURE_2D, texture[0]); glBegin(GL_QUADS); glNormal3f( 0.0f, 0.0f, 1.0f); glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f); glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, -1.0f, 1.0f); glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 1.0f, 1.0f); glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, 1.0f); glEnd(); I need to move it around the screen using x,y,z.... could anyone also tell me how to put a texture on it? Many thanks
Alright, I can''t go into any detail because I have to leave the house in a few minutes. But what you''re looking for are QUADRICS. Just do a search on the net for ''em. NeHe might have a tutorial on em. Also, if you have "OpenGL Game Programming", there''s a whole chapter on quadrics.
Advertisement
If your lucky then this guy(I forgot your name, you posted the torus source code a few days ago) will post here the source code. He''s posted it before. Do a search.
I found it out by myself!

I wrote this proggie: http://spots.flatland.com/alex2k/cube.jpg
remeber to rename it to .zip (flatland doesn''t allow zip files of its server).
I''m just 15 years old and I''ve been programming in basic since I was 5!! moving to C++ wasn''t that easy!

I used NeHe''s tuts as well as some other web sites I found arounf the internet to understand how openGL works.

Please tell me what you think of it.

This topic is closed to new replies.

Advertisement