Please help with drawing a dome...

First off, I want to thank all the people on this board that have helped me in OpenGL. I’ve never been to a board that had such speedy responses (every time) and with such knowledgeable people…Now to my question

I have a 3d plane that stretches by 10000 pixels in all directions…I’ve built some scenery on the plane (like a building or two). I want to make a sky…A simple sky…

I want to encase my little 3D world in a dome(half a sphere)…Not texture mapped (I havn’t learned how to do that yet) I want to create it with pixels with a little space in between (cross hatch) to give the illusion of a star filled sky… Can any one tell an approach to do this (or a tutorial online)…Is it just a simple “for” loop? Thanx again…

hi there,i’ve got some code for you…
it’s the “hard way” for rendering a hemisphere.sorry,but it’s only for borland c…
if you want to do this in openGL,you should check out things like NURBS and meshes…

//
//this code can be compiled only in borland c++
//
#include <graphics.h>
#include <stdlib.h>
#include <iostream.h>
#include <conio.h>
#include <math.h>
#include <dos.h>

#define Pi 3.1415926536

enum Action{move,draw};

struct Point3D
{
int x;
int y;
int z;
Action action;
};

//this function init’s graphics mode in borland c++
void init_gr(void)
{
//detect the hardware
int gdriver = DETECT, gmode, errorcode;

	  initgraph(&gdriver, &gmode, "");

	  errorcode = graphresult();

	  if (errorcode != grOk)    //an error occured
	  {
	  cout &lt;&lt; "error: " &lt;&lt; endl &lt;&lt; grapherrormsg(errorcode) &lt;&lt; endl;
	  cout &lt;&lt; "press a key:";
				 getch();
				 exit(1);               
	  }

}

//ends the gr.mode in borland c++
void end_gr(void)
{
closegraph();
}

//moves the origin:
void MoveTo(int x, int y)
{
moveto(x,y);
}

void LineTo(int x, int y)
{
lineto(x,y);
}

void draw3Dobject(Point3D *object, int N, float rho, float theta,
float phi, float dist_to_screen, int xshift, int yshift)
{
int x,y;
float xe,ye,ze,costh,sinph,cosph,sinth,v11,v12,v13,v21,v22,v32,v33,v23,v43;

/* get the coefficients /
costh=cos(theta);
sinth=sin(theta);
cosph=cos(phi);
sinph=sin(phi);
v11=-sinth; v12=-cosph
costh; v13=-sinphcosth;
v21=costh; v22=-cosph
sinth; v23=-sinphsinth;
v32=sinph;
v33=-cosph;
v43=rho;
for (int i=0;i<N;i++)
{
//get the camera position
xe=v11
(object+i)->x+v21*(object+i)->y;
ye=v12*(object+i)->x+v22*(object+i)->y+v32*(object+i)->z;
ze=v13*(object+i)->x+v23*(object+i)->y+v33*(object+i)->z+v43;
// screen coordinates
x=dist_to_screenxe/ze+xshift;
y=dist_to_screen
ye/ze+yshift;
//drawing
if((object+i)->action==move)
MoveTo(x,y);
else
LineTo(x,y);
}
}

int main(void)
{
const int n=10; //number of segments in the hemisphere
Point3D hemisphere[8nn+n]; //all points of the hemisphere
float rho=1800,theta=Pi,phi=3Pi/4,dist_to_screen=600; //camera position
int xshift=300, yshift=250;
float delta=Pi/(2
n), R=300; /* parameters of the hemisphere */
float alpha,cosa,sina,beta,cosb,sinb; //support variables

// Init
init_gr();

// generate the hemisphere /
for (int i=0;i<4
n;i++)
{
alpha=idelta;
cosa=cos(alpha);
sina=sin(alpha);
for (int j=0;j<n;j++)
{
beta=j
delta;
sinb=sin(beta);
cosb=cos(beta);
hemisphere[i*n+j].x=Rcosasinb;
hemisphere[i*n+j].y=Rsinasinb;
hemisphere[i*n+j].z=-Rcosb;
hemisphere[i*n+j].action=(j==0?move:draw);
}
}
int c=4
nn;
for (i=0;i<n;i++)
{
beta=i
delta;
sinb=sin(beta);
cosb=cos(beta);
for (int j=0;j<4n+1;j++)
{
alpha=j
delta;
cosa=cos(alpha);
sina=sin(alpha);
hemisphere[c+i*(4n+1)+j].x=Rcosasinb;
hemisphere[c+i
(4n+1)+j].y=Rsinasinb;
hemisphere[c+i
(4n+1)+j].z=-Rcosb;
hemisphere[c+i*(4*n+1)+j].action=(j==0?move:draw);
}
}

//drawing
draw3Dobject(hemisphere,8nn+n,rho,theta,phi,dist_to_screen,xshift,yshift);

//shutdown
getch();
end_gr();

return 0;
}

try this out.
Surely gives out the result but is slow in rendering.

void hemiSphere(float radx,float rady,float radz)
{
float i,j,k;
float x,y,z,t1x,t1y,t1z,t2x,t2y,t2z;
glBegin(GL_QUADS);
{
for(i=0;i<91;i+=side)
{
for(j=0;j<359;j+=side)
{
t1x=(sin(j*RAD)cos(iRAD) + sin((j+side)*RAD)*cos((i+side)RAD))/2;
t1y=(sin(i
RAD) + sin((i+side)RAD))/2;
t1z=(cos(j
RAD)cos(iRAD) + cos((j+side)*RAD)*cos((i+side)*RAD))/2;

                             t2x=(sin((j+side)*RAD)*cos(i*RAD) + sin(j*RAD)*cos((i+side)*RAD))/2;
                             t2y=(sin(i*RAD) + sin((i+side)*RAD))/2;
                             t2z=(cos((j+side)*RAD)*cos(i*RAD) + cos(j*RAD)*cos((i+side)*RAD))/2;

                             glNormal3f((t1x+t2x)/2,(t1y+t2y)/2,(t1z+t2z)/2);
                             glVertex3f(radx*sin(j*RAD)*cos(i*RAD),rady*sin(i*RAD),radz*cos(j*RAD)*cos(i*RAD));
                            glVertex3f(radx*sin((j+side)*RAD)*cos(i*RAD),rady*sin(i*RAD),radz*cos((j+side)*RAD)*cos(i    *RAD));
                             glVertex3f(radx*sin((j+side)*RAD)*cos((i+side)*RAD),rady*sin((i+side)*RAD),radz*cos((j+si    de)*RAD)*cos((i+side)*RAD));
                             glVertex3f(radx*sin(j*RAD)*cos((i+side)*RAD),rady*sin((i+side)*RAD),radz*cos(j*RAD)*cos((    i+side)*RAD));
                     }
             }
   }
    glEnd();

}

if in the first loop i = -90 is used result is a sphere.