PDA

View Full Version : layering



pavana
04-12-2010, 08:44 AM
helllo... is there anybody who can help me in creating multiple graphics layers... please help out..

strattonbrazil
04-12-2010, 10:19 AM
Have you tried searching this forum for a similar problem?

http://www.opengl.org/discussion_boards/...true#Post274217 (http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=274217&Searchpa ge=1&Main=52896&Words=layers&Search=true#Post27421 7)

pavana
04-13-2010, 05:02 AM
nope... please tell me the syntax to create layers...

Dark Photon
04-14-2010, 05:33 PM
nope... please tell me the syntax to create layers...
Lots of ways. Depends on what you need. Please define more about your problem. Surface decals? Depth layers? Transparency layers? 3D layers? 2D layers? Sequential rendering of multiple layers? Simultaneous rendering of multiple layers? Pre-defined geometry? Dynamically-generated geometry? ...

Give us an example.

pavana
04-15-2010, 08:53 AM
hello...
i don know the actual concept of layerin... hmmm... i have many things to display... like at the background i want to put a google map and above that i need to write some text and after that i need to point out some regions... all these should be implemented seperateley so that i should get a non erasable screen...so i think i neeed simultaneous rendering of multiple layers. like i need to implement some overlays and underlays.

Thank u.

V-man
04-15-2010, 10:40 AM
You would render each layer to a RTT (render to texture) and then you apply the texture to a quad.
RTT code examples are here
http://www.opengl.org/wiki/GL_EXT_framebuffer_object

Those are short examples. They are not there to teach general programming or concepts.

pavana
04-15-2010, 10:45 AM
Thank u...
Ll try out this.

pavana
04-15-2010, 11:04 AM
sorry... as i told ive many things that are be displayed, if i use this technique it will be a hectic... so using wgl functions will be easy... there in pixel format descriptor we can easily set the overlays and underlays.M thinkin of creatin many layer planes with different intensities... can u help out...

Thank u...

V-man
04-15-2010, 06:50 PM
Try that wgl stuff if you want but I think it is considered ancient history by now. What I gave (GL_EXT_framebuffer_object) FBO is the modern way to do what you want.
Or just forget overlay planes and render directly to the backbuffer. Why do you want overlays anyway? video cards are very fast at rendering millions of pixels and chugging on vertices.

pavana
04-15-2010, 10:32 PM
actually iv gotta project to simulate radar display... they ve specified us to use the concept of layering...so.... we dont have any other options... please send me a sample program to create atleast two layers...

Dark Photon
04-17-2010, 06:34 PM
actually iv gotta project to simulate radar display... they ve specified us to use the concept of layering...

...i have many things to display... like at the background i want to put a google map and above that i need to write some text and after that i need to point out some regions... all these should be implemented seperateley so that i should get a non erasable screen


Simple.

1. Make a list of the stuff to draw in each layer
2. Clear the screen
3. Draw back layer
4. Draw next closer layer
5. Draw next closer layer
...
n. Swap buffers

pavana
04-18-2010, 05:06 AM
hello good evenin..
u meant i should swap the buffers after displayin each layer...?
I tried this but the screen is too much flickering

ZbuffeR
04-18-2010, 05:22 AM
Of course Dark Photon did not meant that, it would flicker !
Only swapbuffers once everything has been drawn.
The steps 1-n must be done for each frame, even if some layers did not change, they still have to be redrawn.

pavana
04-18-2010, 05:35 AM
doi this is enough..? no need to use wgl stuffs...? like creating layer contexts, setting up the pixel format descriptor...

pavana
04-18-2010, 01:16 PM
hello everybody.. this is the code i have

void display(void)
{
int i ;
float R;
r_max=n_circles;
char* str ;

str = (char*)malloc(500*sizeof(char)) ;

sprintf(str , "Radar Display ,Beam Rotating at %.1f rpm at a speed of %.3f" ,rpm, inr) ;
glutSetWindowTitle(str) ;


glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

glColor4f(0.0f ,0.8f , 0.0f, 0.2f) ;
glBlendFunc(GL_SRC_ALPHA,GL_ONE);
glEnable(GL_TEXTURE_2D);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);

glBegin(GL_QUADS);

glTexCoord2f(0.0, 0.0);
glVertex2f(-5.0, -5.0);

glTexCoord2f(0.0, 1.0);
glVertex2f(-5.0, 5.0);

glTexCoord2f(1.0, 1.0);
glVertex2f(5.0, 5.0);

glTexCoord2f(1.0, 0.0);
glVertex2f(5.0, -5.0);


glEnd();

glFlush();
glDisable(GL_TEXTURE_2D);


glClear(GL_DEPTH_BUFFER_BIT) ;
glColor4f(0.0f , 0.2f , 0.0f, 0.6f) ;
glBlendFunc(GL_SRC_ALPHA,GL_ONE);
for(i = 1 ; i <= n_circles ; i++)
{
R = r_min + ((r_max - r_min)/(n_circles-1))*(i-1) ;
Draw_circle(R) ;
}


glClear(GL_DEPTH_BUFFER_BIT) ;
glColor4f(0.0 , 0.2 , 0.0, 0.8) ;
glBlendFunc(GL_SRC_ALPHA,GL_ONE);
glBegin(GL_LINES);
glVertex2f(0.0,0.0);
glVertex2f(r_max,0.0);



glVertex2f(0.0,0.0);
glVertex2f(0.0,r_max);



glVertex2f(0.0,0.0);
glVertex2f(0.0, -r_max);



glVertex2f(0.0,0.0);
glVertex2f(-r_max,0.0);

glEnd();

if(done==30)
{
for(i=1;i<=12;i++)
{
if(i%3!=0)
{
glBegin(GL_LINES);
glVertex2f(0.0,0.0);
glVertex2f(r_max*cos(angle1*i) , r_max*sin(angle1*i)) ;
glEnd();
}
}
}
else
{
for(i=1;i<=8;i++)
{
if(i%2!=0)
{
glBegin(GL_LINES);
glVertex2f(0.0,0.0);
glVertex2f(r_max*cos(angle2*i) , r_max*sin(angle2*i)) ;
glEnd();
}
}
}
glClear(GL_DEPTH_BUFFER_BIT) ;
glPushMatrix() ;
glRotatef(spin , 0.0 , 0.0 , 1.0) ;

glColor4f(0.0f,0.8f,0.0f,0.4f);
glBlendFunc(GL_SRC_ALPHA,GL_ONE);
glBegin(GL_POLYGON) ;
glVertex2f(0.0 , 0.0) ;
glVertex2f(r_max*cos(0.0) , r_max*sin(0.0)) ;
glVertex2f(r_max*cos(0.1) , r_max*sin(0.1)) ;
glEnd() ;
glPopMatrix() ;
spinDisplay();
glutSwapBuffers() ;
}
//here is the main function
void main (int argc, char **argv)
{
printf("Enter the maximum range (50km/60km/75km)\n");
scanf("%f",&amp;max_range);

if(max_range==50 || max_range==75)
n_circles=5;
else if(max_range==60)
n_circles=6;


printf("Enter the angle 30 or 45\n");
scanf("%d",&amp;done);

centerOnScreen ();
glutInit(&amp;argc, argv);
glutInitWindowSize (window_width, window_height);
glutInitWindowPosition (window_x, window_y);
glutInitDisplayMode (GLUT_RGBA | GLUT_DOUBLE);
main_window = glutCreateWindow (window_title);
if (full_screen)
glutFullScreen ();
init();
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
loadTextureFromFile( filename );
setupGLUI ();
glutDisplayFunc (display);


glutReshapeFunc (reshape);


glutMainLoop();
}
i have mapped a google map to a quad. i want this map within one layer,circles within another layer,lines within another layer and polygon with in another layer.
can anybody help me in achieving this using wgl stuffs...

Thank u.

Dark Photon
04-18-2010, 04:04 PM
hello everybody.. this is the code i have...
i have mapped a google map to a quad. i want this map within one layer,circles within another layer,lines within another layer and polygon with in another layer.
can anybody help me in achieving this using wgl stuffs...
Sorry, throwing a bunch of code at us alone isn't gonna cut it. You have to actually state what your problem is, specifically ;)

And the code doesn't even compile as it's not the complete program.

pavana
04-18-2010, 10:41 PM
actually wot m doi is... at the background ive put a google map after that m goi to display some circles and after that some lines (angle markers)and then a rotating triangle from center.
wot i need is.. i need all the above 4 stuffs(map,circles,lines,triangle)to be displayed as seperate layers using the layering concept in opengl.
iv gone thru the wgl stuffs but m not gettin how to go with it...
ll paste the code

#include <windows.h>
#include <math.h>
#include <GL/glui.h>
#include <GL/glut.h>
#include <Gl/glu.h>
# include <string.h>
# include <stdlib.h>
# include <stdio.h>
#ifndef RGBIMAGE_H
#define RGBIMAGE_H
#include <assert.h>

# define dtheta 0.1
# define PI 3.14159

static GLfloat spin = 360.0 ;
static int n_circles ;
static float r_min=1 , r_max=8 ;
static float inr = 0.1 ;
static int done;
static float angle1=0.5257;
static float angle2=0.7877;
static float max_range;

class RgbImage
{
public:
RgbImage();
RgbImage( const char* filename );
RgbImage( int numRows, int numCols ); // Initialize a blank bitmap of this size.
~RgbImage();

bool LoadBmpFile( const char *filename ); // Loads the bitmap from the specified file
bool WriteBmpFile( const char* filename ); // Write the bitmap to the specified file
#ifndef RGBIMAGE_DONT_USE_OPENGL
bool LoadFromOpenglBuffer(); // Load the bitmap from the current OpenGL buffer
#endif

long GetNumRows() const { return NumRows; }
long GetNumCols() const { return NumCols; }
// Rows are word aligned
long GetNumBytesPerRow() const { return ((3*NumCols+3)>>2)<<2; }
const void* ImageData() const { return (void*)ImagePtr; }

const unsigned char* GetRgbPixel( long row, long col ) const;
unsigned char* GetRgbPixel( long row, long col );
void GetRgbPixel( long row, long col, float* red, float* green, float* blue ) const;
void GetRgbPixel( long row, long col, double* red, double* green, double* blue ) const;

void SetRgbPixelf( long row, long col, double red, double green, double blue );
void SetRgbPixelc( long row, long col,
unsigned char red, unsigned char green, unsigned char blue );

// Error reporting. (errors also print message to stderr)
int GetErrorCode() const { return ErrorCode; }
enum {
NoError = 0,
OpenError = 1, // Unable to open file for reading
FileFormatError = 2, // Not recognized as a 24 bit BMP file
MemoryError = 3, // Unable to allocate memory for image data
ReadError = 4, // End of file reached prematurely
WriteError = 5 // Unable to write out data (or no date to write out)
};
bool ImageLoaded() const { return (ImagePtr!=0); } // Is an image loaded?

void Reset(); // Frees image data memory

private:
unsigned char* ImagePtr; // array of pixel values (integers range 0 to 255)
long NumRows; // number of rows in image
long NumCols; // number of columns in image
int ErrorCode; // error code

static short readShort( FILE* infile );
static long readLong( FILE* infile );
static void skipChars( FILE* infile, int numChars );
static void RgbImage::writeLong( long data, FILE* outfile );
static void RgbImage::writeShort( short data, FILE* outfile );

static unsigned char doubleToUnsignedChar( double x );

};
inline RgbImage::RgbImage()
{
NumRows = 0;
NumCols = 0;
ImagePtr = 0;
ErrorCode = 0;
}

inline RgbImage::RgbImage( const char* filename )
{
NumRows = 0;
NumCols = 0;
ImagePtr = 0;
ErrorCode = 0;
LoadBmpFile( filename );
}

inline RgbImage::~RgbImage()
{
delete[] ImagePtr;
}

// Returned value points to three "unsigned char" values for R,G,B
inline const unsigned char* RgbImage::GetRgbPixel( long row, long col ) const
{
assert ( row<NumRows &amp;&amp; col<NumCols );
const unsigned char* ret = ImagePtr;
long i = row*GetNumBytesPerRow() + 3*col;
ret += i;
return ret;
}

inline unsigned char* RgbImage::GetRgbPixel( long row, long col )
{
assert ( row<NumRows &amp;&amp; col<NumCols );
unsigned char* ret = ImagePtr;
long i = row*GetNumBytesPerRow() + 3*col;
ret += i;
return ret;
}

inline void RgbImage::GetRgbPixel( long row, long col, float* red, float* green, float* blue ) const
{
assert ( row<NumRows &amp;&amp; col<NumCols );
const unsigned char* thePixel = GetRgbPixel( row, col );
const float f = 1.0f/255.0f;
*red = f*(float)(*(thePixel++));
*green = f*(float)(*(thePixel++));
*blue = f*(float)(*thePixel);
}

inline void RgbImage::GetRgbPixel( long row, long col, double* red, double* green, double* blue ) const
{
assert ( row<NumRows &amp;&amp; col<NumCols );
const unsigned char* thePixel = GetRgbPixel( row, col );
const double f = 1.0/255.0;
*red = f*(double)(*(thePixel++));
*green = f*(double)(*(thePixel++));
*blue = f*(double)(*thePixel);
}

inline void RgbImage::Reset()
{
NumRows = 0;
NumCols = 0;
delete[] ImagePtr;
ImagePtr = 0;
ErrorCode = 0;
}


#endif


void init ();
void display (void);
void reshape (int w, int h);
void mouse (int button, int state, int x, int y);
void entry (int state);

int window_x;
int window_y;
int window_width = 600;
int window_height = 500;
char *window_title = "GLUI Window Template";
GLuint main_window;
int full_screen = 0;

GLUI * glui_window;
int wireframe = 1;
int draw = 1;
int listbox_item_id = 7;
int radiogroup_item_id = 0;
int radiogroup_item_id1 = 1;
float speed = 50.0;
int az=30;
int hh=10;
int sr=0;
int er=60;
int no=1;
char * ss="ass1";
char * ash=" Hello!!..CAP=30 deg";

void setupGLUI ();
void idle ();
void glui_callback (int arg);

enum
{

MAP_LISTBOX = 0,
NUMBER,
TYPE_OF_TARGAT_RADIOGROUP,
TIME_RADIOGROUP,
ID,
SPEED_SPINNER,
AZIMUTH_EDITTEXT_INT,
HEADING,
START_RANGE,
END_RANGE,
OK_BUTTON,
RESET_BUTTON

};

enum GLUT_SHAPES
{
GLUT_WIRE_CUBE = 0,
GLUT_SOLID_CUBE,
GLUT_WIRE_SPHERE,
GLUT_SOLID_SPHERE,

};
void loadTextureFromFile(char *filename)
{
glClearColor (0.0, 0.0, 0.0, 0.0);
glShadeModel(GL_FLAT);
glEnable(GL_DEPTH_TEST);

RgbImage theTexMap( filename );

// Pixel alignment: each row is word aligned (aligned to a 4 byte boundary)
// Therefore, no need to call glPixelStore( GL_UNPACK_ALIGNMENT, ... );

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);

gluBuild2DMipmaps(GL_TEXTURE_2D, 3,theTexMap.GetNumCols(), theTexMap.GetNumRows(),
GL_RGB, GL_UNSIGNED_BYTE, theTexMap.ImageData() );

}


void centerOnScreen ();
//void drawObject ();
void printMatrixf (float *matrix);

void init ()
{
glClearColor (0.0, 0.0, 0.0, 0.0);
//glColor4f(0.0 , 1.0 , 0.0, 0.4) ;
glBlendFunc(GL_SRC_ALPHA,GL_ONE);
glShadeModel(GL_FLAT) ;
}

void Draw_circle(float r)
{
float angle ;
int i ;
glBegin(GL_LINE_LOOP) ;
for(i = 0 ; i < 100 ; i++)
{
angle = 2*PI*i/100 ;
glVertex2f(r*cos(angle) , r*sin(angle)) ;
}
glEnd() ;
}

void display(void)
{
int i ;
float R , cps;
char* str ;
cps = 10*(inr-0.1)/14 ;
str = (char*)malloc(500*sizeof(char)) ;
sprintf(str , "Radar Display , scanning at %f cycles per second" , cps) ;
glutSetWindowTitle(str) ;

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

glColor4f(0.0f , 1.0f , 0.0f, 0.2f) ;
glBlendFunc(GL_SRC_ALPHA,GL_ONE);
glEnable(GL_TEXTURE_2D);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);

glBegin(GL_QUADS);

glTexCoord2f(0.0, 0.0);
glVertex2f(-8.0, -8.0);

glTexCoord2f(0.0, 1.0);
glVertex2f(-8.0, 8.0);

glTexCoord2f(1.0, 1.0);
glVertex2f(8.0, 8.0);

glTexCoord2f(1.0, 0.0);
glVertex2f(8.0, -8.0);


glEnd();

glFlush();
glDisable(GL_TEXTURE_2D);


glClear(GL_DEPTH_BUFFER_BIT) ;
glColor4f(0.0f , 0.2f , 0.0f, 0.6f) ;
glBlendFunc(GL_SRC_ALPHA,GL_ONE);
for(i = 1 ; i <= n_circles ; i++)
{
R = r_min + ((r_max - r_min)/(n_circles-1))*(i-1) ;
Draw_circle(R) ;
}


glClear(GL_DEPTH_BUFFER_BIT) ;
glColor4f(0.0 , 0.2 , 0.0, 0.8) ;
glBlendFunc(GL_SRC_ALPHA,GL_ONE);
glBegin(GL_LINES);
glVertex2f(0.0,0.0);
glVertex2f(r_max,0.0);

glVertex2f(0.0,0.0);
glVertex2f(0.0,r_max);

glVertex2f(0.0,0.0);
glVertex2f(0.0, -r_max);

glVertex2f(0.0,0.0);
glVertex2f(-r_max,0.0);

glEnd();

if(done==30)
{
for(i=1;i<=12;i++)
{
if(i%3!=0)
{
glBegin(GL_LINES);
glVertex2f(0.0,0.0);
glVertex2f(r_max*cos(angle1*i) , r_max*sin(angle1*i)) ;
glEnd();
}
}
}
else
{
for(i=1;i<=8;i++)
{
if(i%2!=0)
{
glBegin(GL_LINES);
glVertex2f(0.0,0.0);
glVertex2f(r_max*cos(angle2*i) , r_max*sin(angle2*i)) ;
glEnd();
}
}
}
glClear(GL_DEPTH_BUFFER_BIT) ;
glPushMatrix() ;
glRotatef(spin , 0.0 , 0.0 , 1.0) ;

glColor4f(0.0f,1.0f,0.0f,0.4f);
glBlendFunc(GL_SRC_ALPHA,GL_ONE);
glBegin(GL_POLYGON) ;
glVertex2f(0.0 , 0.0) ;
glVertex2f(r_max*cos(0.0) , r_max*sin(0.0)) ;
glVertex2f(r_max*cos(dtheta) , r_max*sin(dtheta)) ;
glEnd() ;
glPopMatrix() ;

glutSwapBuffers() ;
}

void centerOnScreen ()
{
window_x = (glutGet (GLUT_SCREEN_WIDTH) - window_width)/2;
window_y = (glutGet (GLUT_SCREEN_HEIGHT) - window_height)/2;
}


void spinDisplay(void)
{
spin = spin - inr ;
if(spin < 0.0)
spin = spin + 360.0 ;
glutPostRedisplay() ;
}

void reshape (int w, int h)
{
printf ("GLUT: ");
float viewWidth = 1.1;
float viewHeight = 1.1;
glViewport(0, 0, w, h);
h = (h==0) ? 1 : h;
w = (w==0) ? 1 : w;



//printf ("Window Width: %d, Window Height: %d.\n", window_width, window_height);
glMatrixMode(GL_PROJECTION) ;
glLoadIdentity() ;
if ( h < w ) {
viewWidth *= (float)w/(float)h;
}
else {
viewHeight *= (float)h/(float)w;
}
glOrtho(-r_max , r_max , -r_max , r_max , -1.0 , 1.0) ;
//glOrtho( -viewWidth, viewWidth, -viewHeight, viewHeight, -1.0, 1.0 );

glMatrixMode(GL_MODELVIEW);
glLoadIdentity() ;
}

void mouse (int button, int state, int x, int y)
{
printf ("GLUT: ");
switch (button)
{
case GLUT_LEFT_BUTTON:
switch (state)
{
case GLUT_DOWN:
printf ("Mouse Left Button Pressed (Down)...\n");
glutIdleFunc(spinDisplay) ;
break;

case GLUT_UP:
printf ("Mouse Left Button Released (Up)...\n");
break;
}

break;

case GLUT_MIDDLE_BUTTON:
switch (state)
{
case GLUT_DOWN:
printf ("Mouse Middle Button Pressed (Down)...\n");
break;

case GLUT_UP:
printf ("Mouse Middle Button Released (Up)...\n");
break;
}

break;

case GLUT_RIGHT_BUTTON:

switch (state)
{
case GLUT_DOWN:
printf ("Mouse Right Button Pressed (Down)...\n");
glutIdleFunc(NULL) ;
break;

case GLUT_UP:
printf ("Mouse Right Button Released (Up)...\n");
break;
}

break;

}
}

void keyboard(unsigned char key , int x , int y)
{
switch(key)
{
case 'u' :
if(inr < PI)
inr = inr + 0.1 ;
break ;

case 'd' :
if(inr > 0.0)
inr = inr - 0.1 ;
break ;
}
}

void motion (int x, int y)
{
printf ("GLUT: ");
printf ("Mouse Drag Position: %d, %d.\n", x, y);
}

void entry (int state)
{
printf ("GLUT: ");
if (state == GLUT_ENTERED)
printf ("Mouse entered GLUT window...\n");

else if (state == GLUT_LEFT)
printf ("Mouse left GLUT window...\n");
}

void setupGLUI ()
{
GLUI_Master.set_glutIdleFunc (idle);
glui_window = GLUI_Master.create_glui ("Target Data", 0, window_x +705, window_y-150);

GLUI_Panel *op = glui_window->add_panel ("Number of Targets");

GLUI_EditText *ttt = glui_window->add_edittext_to_panel (op, "number", GLUI_EDITTEXT_INT, &amp;no, NUMBER, glui_callback);
ttt->set_int_limits ( 0, 10 );

GLUI_Panel *op_panel = glui_window->add_panel ("Geographical Area");

glui_window->add_separator_to_panel (op_panel);

GLUI_Listbox *Map_listbox = glui_window->add_listbox_to_panel (op_panel,
"map", &amp;listbox_item_id, MAP_LISTBOX, glui_callback);
glui_window->add_separator_to_panel (op_panel);

Map_listbox->add_item (1, "Mysore");
Map_listbox->add_item (2, "Banglore");
Map_listbox->add_item (3, "Delhi");
Map_listbox->add_item (4, "Hydrabad");
Map_listbox->add_item (5, "Mumbai");
Map_listbox->add_item (6, "India map");
Map_listbox->add_item (7, "World map");
Map_listbox->set_int_val (7);

GLUI_Panel *loose3 = glui_window->add_panel ("");

GLUI_Rollout *ot_rollout = glui_window->add_rollout_to_panel (loose3,"Type of the Target");

GLUI_RadioGroup *ot_group = glui_window->add_radiogroup_to_panel
(ot_rollout, &amp;radiogroup_item_id, TYPE_OF_TARGAT_RADIOGROUP, glui_callback);

glui_window->add_radiobutton_to_group( ot_group, "Incoming" );
glui_window->add_radiobutton_to_group( ot_group, "Outgoing" );

GLUI_Panel *transformation_panel = glui_window->add_panel ("Target Data");

GLUI_Panel *transformation_panel2 = glui_window->add_panel_to_panel (transformation_panel, "");

glui_window->add_separator_to_panel (transformation_panel2);

GLUI_EditText *edit0 = glui_window->add_edittext_to_panel (transformation_panel2, "Track ID", GLUI_EDITTEXT_TEXT, &amp;ss, ID, glui_callback);

glui_window->add_separator_to_panel (transformation_panel2);

GLUI_Spinner *spinner = glui_window->add_spinner_to_panel (transformation_panel2, "Speed", GLUI_SPINNER_FLOAT, &amp;speed, SPEED_SPINNER, glui_callback);
glui_window->add_separator_to_panel (transformation_panel2);
spinner->set_float_limits ( 0.0, 100.0 );

GLUI_EditText *edit = glui_window->add_edittext_to_panel (transformation_panel2, "Azimuth", GLUI_EDITTEXT_INT, &amp;az, AZIMUTH_EDITTEXT_INT, glui_callback);
edit->set_int_limits ( 0, 360 );
glui_window->add_separator_to_panel (transformation_panel2);

GLUI_EditText *edit3 = glui_window->add_edittext_to_panel (transformation_panel2, "Heading", GLUI_EDITTEXT_INT, &amp;hh, HEADING, glui_callback);
edit3->set_int_limits ( 0, 360 );
glui_window->add_separator_to_panel (transformation_panel2);
GLUI_EditText *edit1 = glui_window->add_edittext_to_panel (transformation_panel2, "Stat Range",GLUI_EDITTEXT_INT, &amp;sr, START_RANGE, glui_callback);
edit1->set_int_limits ( 0, 75 );
glui_window->add_separator_to_panel (transformation_panel2);
GLUI_EditText *edit2 = glui_window->add_edittext_to_panel (transformation_panel2, "End Range",GLUI_EDITTEXT_INT, &amp;er, END_RANGE, glui_callback);
edit2->set_int_limits ( 0, 75 );
glui_window->add_separator_to_panel (transformation_panel2);

GLUI_Panel *loose = glui_window->add_panel ("");

GLUI_Rollout *ot_rollout1 = glui_window->add_rollout_to_panel (loose,"Time for radar Beam Roation");

GLUI_RadioGroup *ot_group1 = glui_window->add_radiogroup_to_panel
(ot_rollout1, &amp;radiogroup_item_id1, TIME_RADIOGROUP, glui_callback);

glui_window->add_radiobutton_to_group( ot_group1, "2 sec" );
glui_window->add_radiobutton_to_group( ot_group1, "4 sec" );
glui_window->add_radiobutton_to_group( ot_group1, "8 sec" );

GLUI_Panel *loose1 = glui_window->add_panel ("");

GLUI_Panel *cap = glui_window->add_panel_to_panel(loose1,"CAP");

glui_window->add_statictext_to_panel(cap,ash);

GLUI_Panel *op_pane2 = glui_window->add_panel ("");

glui_window->add_button_to_panel (op_pane2,"OK", OK_BUTTON, glui_callback);

glui_window->add_separator_to_panel (op_pane2);

glui_window->add_button_to_panel (op_pane2,"RESET", RESET_BUTTON, glui_callback);

glui_window->set_main_gfx_window( main_window );
}

void glui_callback (int control_id)
{
printf ("GLUI: ");

switch (control_id)
{
case MAP_LISTBOX:
printf ("Map List box item changed: ");
printf ("Item %d selected.\n", listbox_item_id);
break;

case NUMBER:
printf ("Number of the targets: %d.\n", no);
break;

case TYPE_OF_TARGAT_RADIOGROUP:
printf ("Radio Button %d selected.\n", radiogroup_item_id);
break;

case TIME_RADIOGROUP:
printf ("Radio Button %d selected.\n", radiogroup_item_id);
break;

case ID:
printf ("ID of the target\n");
break;

case SPEED_SPINNER:
printf ("Speed of the target: %f.\n", speed);
break;

case AZIMUTH_EDITTEXT_INT:
printf ("Azimuth of the target: %d.\n", az);
break;

case HEADING:
printf ("Heading of the target: %d.\n", hh);
break;

case START_RANGE:
printf ("Start Range of the target: %d.\n", sr);
break;

case END_RANGE:
printf ("Start Range of the target: %d.\n", er);
break;

case OK_BUTTON:
printf ("OK Button clicked... Exit!\n");
exit (1);
break;

case RESET_BUTTON:
printf ("RESET Button clicked... Exit!\n");
break;
}
}

void idle ()
{
glutSetWindow (main_window);
glutPostRedisplay ();
Sleep (50);
}
char* filename = "world.bmp";
void main (int argc, char **argv)
{
printf("Enter the maximum range (50km/60km/75km)\n");
scanf("%f",&amp;max_range);

if(max_range==50 || max_range==75)
n_circles=5;
else if(max_range==60)
n_circles=6;


printf("Enter the angle 30 or 45\n");
scanf("%d",&amp;done);

centerOnScreen ();
glutInit(&amp;argc, argv);
glutInitWindowSize (window_width, window_height);
glutInitWindowPosition (window_x, window_y);
glutInitDisplayMode (GLUT_RGBA | GLUT_DOUBLE);
main_window = glutCreateWindow (window_title);
if (full_screen)
glutFullScreen ();
init();
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
loadTextureFromFile( filename );
glutDisplayFunc (display);


glutReshapeFunc (reshape);
glutMouseFunc (mouse);
glutKeyboardFunc(keyboard) ;
glutMotionFunc (motion);
glutEntryFunc (entry);
setupGLUI ();

glutMainLoop();
}

#ifndef RGBIMAGE_DONT_USE_OPENGL
#include "GL/gl.h"
#endif

RgbImage::RgbImage( int numRows, int numCols )
{
NumRows = numRows;
NumCols = numCols;
ImagePtr = new unsigned char[NumRows*GetNumBytesPerRow()];
if ( !ImagePtr ) {
fprintf(stderr, "Unable to allocate memory for %ld x %ld bitmap.\n",
NumRows, NumCols);
Reset();
ErrorCode = MemoryError;
}
// Zero out the image
unsigned char* c = ImagePtr;
int rowLen = GetNumBytesPerRow();
for ( int i=0; i<NumRows; i++ ) {
for ( int j=0; j<rowLen; j++ ) {
*(c++) = 0;
}
}
}

bool RgbImage::LoadBmpFile( const char* filename )
{
Reset();
FILE* infile = fopen(filename, "rb" ); // Open for reading binary data
if ( !infile ) {
fprintf(stderr, "Unable to open file: %s\n",filename);
ErrorCode = OpenError;
return false;
}

bool fileFormatOK = false;
int bChar = fgetc( infile );
int mChar = fgetc( infile );
if ( bChar=='B' &amp;&amp; mChar=='M' ) { // If starts with "BM" for "BitMap"
skipChars( infile, 4+2+2+4+4 ); // Skip 4 fields we don't care about
NumCols = readLong( infile );
NumRows = readLong( infile );
skipChars( infile, 2 ); // Skip one field
int bitsPerPixel = readShort( infile );
skipChars( infile, 4+4+4+4+4+4 ); // Skip 6 more fields

if ( NumCols>0 &amp;&amp; NumCols<=100000 &amp;&amp; NumRows>0 &amp;&amp; NumRows<=100000
&amp;&amp; bitsPerPixel==24 &amp;&amp; !feof(infile) ) {
fileFormatOK = true;
}
}
if ( !fileFormatOK ) {
Reset();
ErrorCode = FileFormatError;
fprintf(stderr, "Not a valid 24-bit bitmap file: %s.\n", filename);
fclose ( infile );
return false;
}

// Allocate memory
ImagePtr = new unsigned char[NumRows*GetNumBytesPerRow()];
if ( !ImagePtr ) {
fprintf(stderr, "Unable to allocate memory for %ld x %ld bitmap: %s.\n",
NumRows, NumCols, filename);
Reset();
ErrorCode = MemoryError;
fclose ( infile );
return false;
}

unsigned char* cPtr = ImagePtr;
for ( int i=0; i<NumRows; i++ ) {
int j;
for ( j=0; j<NumCols; j++ ) {
*(cPtr+2) = fgetc( infile ); // Blue color value
*(cPtr+1) = fgetc( infile ); // Green color value
*cPtr = fgetc( infile ); // Red color value
cPtr += 3;
}
int k=3*NumCols; // Num bytes already read
for ( ; k<GetNumBytesPerRow(); k++ ) {
fgetc( infile ); // Read and ignore padding;
*(cPtr++) = 0;
}
}
if ( feof( infile ) ) {
fprintf( stderr, "Premature end of file: %s.\n", filename );
Reset();
ErrorCode = ReadError;
fclose ( infile );
return false;
}
fclose( infile ); // Close the file
return true;
}

short RgbImage::readShort( FILE* infile )
{
// read a 16 bit integer
unsigned char lowByte, hiByte;
lowByte = fgetc(infile); // Read the low order byte (little endian form)
hiByte = fgetc(infile); // Read the high order byte

// Pack together
short ret = hiByte;
ret <<= 8;
ret |= lowByte;
return ret;
}

long RgbImage::readLong( FILE* infile )
{
// Read in 32 bit integer
unsigned char byte0, byte1, byte2, byte3;
byte0 = fgetc(infile); // Read bytes, low order to high order
byte1 = fgetc(infile);
byte2 = fgetc(infile);
byte3 = fgetc(infile);

// Pack together
long ret = byte3;
ret <<= 8;
ret |= byte2;
ret <<= 8;
ret |= byte1;
ret <<= 8;
ret |= byte0;
return ret;
}

void RgbImage::skipChars( FILE* infile, int numChars )
{
for ( int i=0; i<numChars; i++ ) {
fgetc( infile );
}
}



bool RgbImage::WriteBmpFile( const char* filename )
{
FILE* outfile = fopen( filename, "wb" ); // Open for reading binary data
if ( !outfile ) {
fprintf(stderr, "Unable to open file: %s\n", filename);
ErrorCode = OpenError;
return false;
}

fputc('B',outfile);
fputc('M',outfile);
int rowLen = GetNumBytesPerRow();
writeLong( 40+14+NumRows*rowLen, outfile ); // Length of file
writeShort( 0, outfile ); // Reserved for future use
writeShort( 0, outfile );
writeLong( 40+14, outfile ); // Offset to pixel data
writeLong( 40, outfile ); // header length
writeLong( NumCols, outfile ); // width in pixels
writeLong( NumRows, outfile ); // height in pixels (pos for bottom up)
writeShort( 1, outfile ); // number of planes
writeShort( 24, outfile ); // bits per pixel
writeLong( 0, outfile ); // no compression
writeLong( 0, outfile ); // not used if no compression
writeLong( 0, outfile ); // Pixels per meter
writeLong( 0, outfile ); // Pixels per meter
writeLong( 0, outfile ); // unused for 24 bits/pixel
writeLong( 0, outfile ); // unused for 24 bits/pixel

// Now write out the pixel data:
unsigned char* cPtr = ImagePtr;
for ( int i=0; i<NumRows; i++ ) {
// Write out i-th row's data
int j;
for ( j=0; j<NumCols; j++ ) {
fputc( *(cPtr+2), outfile); // Blue color value
fputc( *(cPtr+1), outfile); // Blue color value
fputc( *(cPtr+0), outfile); // Blue color value
cPtr+=3;
}
// Pad row to word boundary
int k=3*NumCols; // Num bytes already read
for ( ; k<GetNumBytesPerRow(); k++ ) {
fputc( 0, outfile ); // Read and ignore padding;
cPtr++;
}
}

fclose( outfile ); // Close the file
return true;
}

void RgbImage::writeLong( long data, FILE* outfile )
{
// Read in 32 bit integer
unsigned char byte0, byte1, byte2, byte3;
byte0 = (unsigned char)(data&amp;0x000000ff); // Write bytes, low order to high order
byte1 = (unsigned char)((data>>8)&amp;0x000000ff);
byte2 = (unsigned char)((data>>16)&amp;0x000000ff);
byte3 = (unsigned char)((data>>24)&amp;0x000000ff);

fputc( byte0, outfile );
fputc( byte1, outfile );
fputc( byte2, outfile );
fputc( byte3, outfile );
}

void RgbImage::writeShort( short data, FILE* outfile )
{
// Read in 32 bit integer
unsigned char byte0, byte1;
byte0 = data&0x000000ff; // Write bytes, low order to high order
byte1 = (data>>8)&0x000000ff;

fputc( byte0, outfile );
fputc( byte1, outfile );
}




void RgbImage::SetRgbPixelf( long row, long col, double red, double green, double blue )
{
SetRgbPixelc( row, col, doubleToUnsignedChar(red),
doubleToUnsignedChar(green),
doubleToUnsignedChar(blue) );
}

void RgbImage::SetRgbPixelc( long row, long col,
unsigned char red, unsigned char green, unsigned char blue )
{
assert ( row<NumRows &amp;&amp; col<NumCols );
unsigned char* thePixel = GetRgbPixel( row, col );
*(thePixel++) = red;
*(thePixel++) = green;
*(thePixel) = blue;
}


unsigned char RgbImage::doubleToUnsignedChar( double x )
{
if ( x>=1.0 ) {
return (unsigned char)255;
}
else if ( x<=0.0 ) {
return (unsigned char)0;
}
else {
return (unsigned char)(x*255.0); // Rounds down
}
}
// Bitmap file format (24 bit/pixel form) BITMAPFILEHEADER
// Header (14 bytes)
// 2 bytes: "BM"
// 4 bytes: long int, file size
// 4 bytes: reserved (actually 2 bytes twice)
// 4 bytes: long int, offset to raster data
// Info header (40 bytes) BITMAPINFOHEADER
// 4 bytes: long int, size of info header (=40)
// 4 bytes: long int, bitmap width in pixels
// 4 bytes: long int, bitmap height in pixels
// 2 bytes: short int, number of planes (=1)
// 2 bytes: short int, bits per pixel
// 4 bytes: long int, type of compression (not applicable to 24 bits/pixel)
// 4 bytes: long int, image size (not used unless compression is used)
// 4 bytes: long int, x pixels per meter
// 4 bytes: long int, y pixels per meter
// 4 bytes: colors used (not applicable to 24 bit color)
// 4 bytes: colors important (not applicable to 24 bit color)
// "long int" really means "unsigned long int"
// Pixel data: 3 bytes per pixel: RGB values (in reverse order).
// Rows padded to multiples of four.


#ifndef RGBIMAGE_DONT_USE_OPENGL

bool RgbImage::LoadFromOpenglBuffer() // Load the bitmap from the current OpenGL buffer
{
int viewportData[4];
glGetIntegerv( GL_VIEWPORT, viewportData );
int&amp; vWidth = viewportData[2];
int&amp; vHeight = viewportData[3];

if ( ImagePtr==0 ) { // If no memory allocated
NumRows = vHeight;
NumCols = vWidth;
ImagePtr = new unsigned char[NumRows*GetNumBytesPerRow()];
if ( !ImagePtr ) {
fprintf(stderr, "Unable to allocate memory for %ld x %ld buffer.\n",
NumRows, NumCols);
Reset();
ErrorCode = MemoryError;
return false;
}
}
assert ( vWidth>=NumCols &amp;&amp; vHeight>=NumRows );
int oldGlRowLen;
if ( vWidth>=NumCols ) {
glGetIntegerv( GL_UNPACK_ROW_LENGTH, &amp;oldGlRowLen );
glPixelStorei( GL_UNPACK_ROW_LENGTH, NumCols );
}
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);

// Get the frame buffer data.
glReadPixels( 0, 0, NumCols, NumRows, GL_RGB, GL_UNSIGNED_BYTE, ImagePtr);

// Restore the row length in glPixelStorei (really ought to restore alignment too).
if ( vWidth>=NumCols ) {
glPixelStorei( GL_UNPACK_ROW_LENGTH, oldGlRowLen );
}
return true;
}

#endif // RGBIMAGE_DONT_USE_OPENGL

Dark Photon
04-19-2010, 04:31 AM
actually wot m doi is... at the background ive put a google map after that m goi to display some circles and after that some lines (angle markers)and then a rotating triangle from center.
Ok, sure. We got the general concept. What we don't have is any specifics.


wot i need is.. i need all the above 4 stuffs(map,circles,lines,triangle)to be displayed as seperate layers using the layering concept in opengl.
Ok. You're just talking about drawing these 2D annotations on top of the base map in a specific order. Seems pretty simple.


iv gone thru the wgl stuffs but m not gettin how to go with it...
You still didn't state what "specifically" isn't working. Just saying "it's broke; what's wrong?" doesn't cut it. This isn't a "fix my program for me" forum. State:
What "specifically" is your technical approach (more detailed than the general concept outlined above), what "specifically" is not working properly, and what "specifically" surprises you about the behavior you're seeing compared to what you thought should happen.
Please check out Eric Raymond's FAQ on Asking Questions (http://catb.org/~esr/faqs/smart-questions.html), in particular the Be precise and informative about your problem (http://catb.org/~esr/faqs/smart-questions.html#beprecise) section.

For instance, why are you so convinced there are "wgl stuffs" involved in the solution, to whatever your specific problem is?

pavana
04-19-2010, 05:02 AM
hmmm... k.
when m trying to rotate the triangle at 7.5rpm,it is rotating at a slower rate than expected. so i thot of rendering each of my stuffs as seperate layers.. i gottu know that using wglCreateLayerContext function we can create multiple layers. m tryin out that,but m getting only the upper most layer displayed. is that i need to setup the pixel format descriptor for each of the layer..? if so wot fields need to be changed...?

Thank u.

Dark Photon
04-19-2010, 05:29 AM
when m trying to rotate the triangle at 7.5rpm,it is rotating at a slower rate than expected.
So rotate once every 8 seconds, as sort of a "please wait" indicator. Rendering the triangle should be super-fast, so that suggests something about the other layers you're rendering is slow, or your method for determining what rotation to display the triangle at is geared toward FPS rather than "clock time". Use the latter and you can get that 7.5 RPM you want, though it might be choppy if your updates aren't very frequent.


so i thot of rendering each of my stuffs as seperate layers... wglCreateLayerContext...
Wait. So something about your rendering code is slow/non-optimal, you haven't figured out what it is yet, so you're going to try rendering your spinning "please wait" triangle to "overlay planes" which are not universally available to try to avoid redrawing the underlying layers?

Ok, at least now I understand what you're calling "layers" (layers means lots of things, and this is not one of the more common ones; more commonly, these things are called "overlay planes").

Yes, if you want to go that route, that'll work given that overlay planes are available and enabled on your platform.

But a solution that won't lock you into not-necessarily-available overlay planes is to simply render your other layers (except for your spinning please-wait triangle) onto an off-screen renderbuffer or texture using a "framebuffer object" (aka FBO). Then when it comes time to rerender your window, you simply copy from that renderbuffer or texture to the system (window) framebuffer, and then draw your spinning triangle please-wait logo on top.

You only re-render your off-screen framebuffer when the map data or one of the other layers changes. And you can re-use each one of this renders many times to make your "please wait" gizmo rotate faster or more fluidly.

For instance:
* Re-render off-screen FBO with map/etc.
* Re-render window (copy off-screen FBO to window, draw triangle)
* Re-render window (copy off-screen FBO to window, draw triangle)
* Re-render window (copy off-screen FBO to window, draw triangle)
...
* Map update received, so...
* Re-render off-screen FBO
* Re-render window
* Re-render window
...

As you can see, with this we don't have to "regenerate" the underlying layers from-scratch every time we draw the window. We just copy the last rendered contents onto the window which is super-fast/cheap.

pavana
04-19-2010, 05:36 AM
hmmm k... ive gone through the stuff wot ur tellin. ll try it out.

Thank u.

pavana
04-20-2010, 09:03 AM
hello...
i tried the FBO stuff... the code is getting compiled... but the thing is during execution an exception is gettin raised..
wot to do for this..?

Thank u

pavana
04-20-2010, 02:14 PM
hello..
when wglMakeCurrent function is called, m getting an empty screen.!
can anybody help...

Thank u.

Dark Photon
04-21-2010, 04:59 AM
i tried the FBO stuff... the code is getting compiled... but the thing is during execution an exception is gettin raised..
wot to do for this..?
Debug it! Post a short test program so folks can help! For max portability, use GLUT.

pavana
04-21-2010, 09:03 AM
hmmmm iv debugged.. but not getting.k ll post ma program.

#include<glew.h>
#include<wglew.h>
# include <GL/glut.h>
# include <stdlib.h>
# include <math.h>
# include <string.h>

static GLfloat spin = 360.0 ;
static float r_min=1 , r_max=8 ;
# define dtheta 0.1

GLuint color_tex;
GLuint fb;
GLuint depth_rb;
int width=512;
int height=512;

void init(void)
{

glShadeModel(GL_FLAT) ;
glClearColor(0.0f, 0.0f, 0.2f, 0.5f);
glClearDepth(1.0f);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glViewport(0,0,800,600);

glGenFramebuffersEXT(1, &amp;fb);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);
glGenRenderbuffersEXT(1, &amp;depth_rb);
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, depth_rb);
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT24, 256, 256);


glGenTextures(1, &amp;color_tex);
glBindTexture(GL_TEXTURE_2D,color_tex);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);

glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, color_tex, 0);
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, depth_rb);

GLenum status;
status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
if(status != GL_FRAMEBUFFER_COMPLETE_EXT)
exit(1);

glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
}

void display(void)
{

glColor3f(1.0 , 1.0 , 1.0) ;

glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);

glPushAttrib(GL_VIEWPORT_BIT);
glViewport(0,0,512,512);

glColor4f(0.0 , 1.0 , 0.0, 0.1) ;
glBegin(GL_POLYGON) ;
glVertex2f(0.0 , 0.0) ;
glVertex2f(r_max*cos(0.0) , r_max*sin(0.0)) ;
glVertex2f(r_max*cos(dtheta) , r_max*sin(dtheta)) ;
glEnd() ;
glClearColor(0.0f, 0.0f, 0.0f, 0.5f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();

glPopAttrib();

glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
glClearColor(0.0f, 0.0f, 0.2f, 0.5f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glBindTexture(GL_TEXTURE_2D,color_tex);

glutSwapBuffers() ;
}

void reshape(int w , int h)
{
glViewport(0 , 0 , (GLsizei)w , (GLsizei)h) ;
glMatrixMode(GL_PROJECTION) ;
glLoadIdentity() ;
glOrtho(-r_max , r_max , -r_max , r_max , -1.0 , 1.0) ;
glMatrixMode(GL_MODELVIEW);
glLoadIdentity() ;
}

void ShutDown(void)
{
glDeleteFramebuffersEXT(1, &amp;fb);
glDeleteRenderbuffersEXT(1, &amp;depth_rb);
glDeleteTextures(1,&amp;color_tex);
}

void keyboard(unsigned char key,int x,int y)
{
switch(key)
{
case 27: // When Escape Is Pressed...
ShutDown();
exit(0); // Exit The Program
break;
default:
break;
}
}

int main(int argc , char* argv[])
{
glutInit(&amp;argc , argv) ;
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB) ;
glutInitWindowSize(750 , 750) ;
glutInitWindowPosition(0,0) ;
glutCreateWindow("fbo") ;
init() ;
glutDisplayFunc(display);
glutReshapeFunc(reshape);
glutKeyboardFunc(keyboard) ;
glutMainLoop() ;
return 0 ;
}

Dark Photon
04-22-2010, 05:40 AM
hmmmm iv debugged.. but not getting.k ll post ma program.
Well, as it looks like you found out (or almost found out), your framebuffer status returned from glCheckFramebufferStatus is GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS.

The problem being you're trying to configure an FBO with a 512x512 color buffer but a 256x256 depth buffer. Make them the same resolution.

pavana
04-22-2010, 07:18 AM
hello....

thanks for ur suggestion. but still m gettin an exception while runnin ma program..!

then i tried including these statements..

switch(status)
{
case GL_FRAMEBUFFER_COMPLETE_EXT:
printf("good");
default:
HANDLE_THE_ERROR;
}

m getting the error like, HANDLE_THE_ERROR undeclared identifier... wot to do...?

And iv tried that overlay planes also... can u please tell me how to check whether my platform supports overlays...? if it doesn't support wot should be done..?

Thank u.

Dark Photon
04-22-2010, 05:08 PM
thanks for ur suggestion. but still m gettin an exception while runnin ma program..!
Define exception. If you fixed that bug I mentioned, then you shouldn't be getting an exception. I get no exception here on the latest NVidia drivers, and a valgrind run on this app is clean. The window comes up and runs fine.


then i tried including these statements..

switch(status)
{
case GL_FRAMEBUFFER_COMPLETE_EXT:
printf("good");
default:
HANDLE_THE_ERROR;
}
m getting the error like, HANDLE_THE_ERROR undeclared identifier... wot to do...?
You forgot the break after printf.


And iv tried that overlay planes also... can u please tell me how to check whether my platform supports overlays...? if it doesn't support wot should be done..?
What's your GPU and OS? Most GPUs don't have overlay planes AFAIK. In the NVidia world, only non-NVS Quadros do (per the NVidia driver README).

pavana
04-22-2010, 07:09 PM
hmmm... i tried putting break after printf. but still m gettin the same exception..!
i think ma platform is not supporting..!
m using WindowsXP version 2002(service pack3)...!
and ma GPU is INTEL(R) G33/G31 Express Chipset family..
will this support both FBO and overlay planes..?
if not wot should be done....?
DO i need to upgrade this version..?

Thank u..

pavana
04-26-2010, 07:13 PM
hello...
Does quadro4 500 GoGL support overlay planes...?

Dark Photon
04-27-2010, 06:05 AM
Does quadro4 500 GoGL support overlay planes...?

* http://lmgtfy.com/?q=quadro4 500 site:nvidia.com (http://lmgtfy.com/?q=quadro4+500+site%3Anvidia.com)

pavana
04-27-2010, 08:19 AM
hello..
I gottu know that there is nothin to worry about GPUs and all. If we have the whole OpenGL package we can implement overlay planes... Is that true...? If so, can you please tell me how to get the OpenGL full package..

Thank you.

ZbuffeR
04-27-2010, 08:43 AM
No.
http://www.opengl.org/wiki/Getting_started

pavana
04-28-2010, 05:42 AM
hello..
Can anybody tell me wot driver will support Overlay planes for Intel GMA 950 chipset...

Thank u.

ZbuffeR
04-28-2010, 05:52 AM
None.

pavana
04-28-2010, 06:17 AM
So do i need to get another graphics card..? which one..?

pavana
05-04-2010, 05:53 AM
hello....
hmmm finally i completed 80 percent of my display part....
the remaining thing is i need to display the target movement.
for every 8 secs the target position should be changed... can any body tell me how to do this...? is there any special openGL function..?

Thank u.

ZbuffeR
05-04-2010, 06:52 AM
Use a timer system, for example if you use Glut you have glutTimerFunc which allow to schedule a function call in a future time.

pavana
05-07-2010, 01:13 AM
hello...
i have a doubt
The concept of overlay planes was introduced in 90's..then how come that only Nvidia Quadro support overlay planes...!!!as it is a recent invention....

Dark Photon
05-07-2010, 04:20 AM
The concept of overlay planes was introduced in 90's..then how come that only Nvidia Quadro support overlay planes...
Because it is not something Joe-gamer needs. So it's used as a feature to distinguish the Quadro line, which is typically bought by folks that have more money than Joe gamer.

GeForce = Joe gamer
Quadro = Workstation/CAD/DCC user