Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
G

GAJERA

@GAJERA
About
Posts
31
Topics
10
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Object movement in OpenGl
    G GAJERA

    Ok,Here i am sending you my RenderScene function which is continuous call. I am loading image Once only.The other are text,Line,Point and 3D object.

    Void RenderScene()
    {
    glClear(GL_COLOR_BUFFER_BIT| GL_DEPTH_BUFFER_BIT );

    float R = (float)GetRValue(m\_s3DDispManagerSetting.dwScreenBkColor)/255.0;
    float G = (float)GetGValue(m\_s3DDispManagerSetting.dwScreenBkColor)/255.0;
    float B = (float)GetBValue(m\_s3DDispManagerSetting.dwScreenBkColor)/255.0;
    ::glClearColor(R, G, B, 0.0f); 
    
    
    	glPushMatrix();
    glLoadIdentity();
    
    glShadeModel(GL\_FLAT) ;
    glEnable(GL\_NORMALIZE) ;
    
    multimap::iterator it;	
    
    //Scalling as per user selection
    glScalef(m\_fScale, m\_fScale, m\_fScale);
    
    //3D rotation angle
    glRotated(m\_fRAngle\[0\],1.0, 0.0, 0.0);
    glRotated(m\_fRAngle\[1\],0.0,1.0, 0.0);
    glRotated(m\_fRAngle\[2\],0.0,0.0,1.0);
    
    
    glDepthMask(GL\_TRUE);
    
    
    for(it = m\_sMapObjectInfo.begin(); it != m\_sMapObjectInfo.end(); it++)
    {
    	stObjectInfo sObjectInfo = (\*it).second;
    	if(sObjectInfo.eObjectType == OBJECT\_LINE)
    		glCallList((\*it).first);
    }		
    for(it = m\_sMapObjectInfo.begin(); it != m\_sMapObjectInfo.end(); it++)
    {
    	stObjectInfo sObjectInfo = (\*it).second;
    	if(sObjectInfo.eObjectType == OBJECT\_POINT)
    		glCallList((\*it).first);
    }
    
    for(it = m\_sMapObjectInfo.begin(); it != m\_sMapObjectInfo.end(); it++)
    {
    	stObjectInfo sObjectInfo = (\*it).second;
    	if(sObjectInfo.eObjectType == OBJECT\_TEXT)
    		glCallList((\*it).first);
    }		
    for(it = m\_sMapObjectInfo.begin(); it != m\_sMapObjectInfo.end(); it++)
    {
    	stObjectInfo sObjectInfo = (\*it).second;
    	if(sObjectInfo.eObjectType == OBJECT\_IMAGE)
    	   glCallList((\*it).first);
    }
    for(it = m\_sMapObjectInfo.begin(); it != m\_sMapObjectInfo.end(); it++)
    
    
    glEnable(GL\_CULL\_FACE);
    glCullFace(GL\_BACK);			
    glFrontFace(GL\_CW);		
    
    for(it = m\_sMapObjectInfo.begin(); it != m\_sMapObjectInfo.end(); it++)
    {
    	stObjectInfo sObjectInfo = (\*it).second;
    	if(sObjectInfo.eObjectType == OBJECT\_3D)
    	{
    		glMaterialfv(GL\_FRONT\_AND\_BACK , GL\_DIFFUSE, sObjectInfo.fIntensity);
    		glCallList((\*it).first);
    	}
    }
    
    glDisable(GL\_CULL\_FACE);
    glDisable(GL\_BLEND);			
    glPopMatrix();	
    

    }

    C / C++ / MFC graphics game-dev performance tutorial

  • Object movement in OpenGl
    G GAJERA

    Hi All I am loading multiple object On OpenGL.When i load Only one object ,the object movement is very smooth.After the increase the number object on screen at that time the movement is going slow. Please suggest the way how to increase the speed when multiple object on screen. Thanks

    C / C++ / MFC graphics game-dev performance tutorial

  • How to reduce CPU uages with Opengl ?
    G GAJERA

    Hi All I am using gluBuild2DMipmaps() for show live video buffer. but it is using the CPU around 50%. Please suggest how to reduce CPU usages. Here I am sending you the source code for render.

    for (int loop=0; loop<2; loop++) // Loop To Draw Our 4 Views
    {
    if (loop==0) // If We Are Drawing The First Scene
    {
    m_bRenderFromVideo=FALSE;
    if(m_pbVideoData)
    gluBuild2DMipmaps(GL_TEXTURE_2D, 3, m_iVideoHeight,m_iVideoWidth ,GL_LUMINANCE, GL_UNSIGNED_BYTE, m_pbVideoData);

    		glViewport(m\_iNoOfColumn - m\_iNoOfColumn \* m\_iSizeVideo.x, m\_iNoOfRow - m\_iNoOfRow \* m\_iSizeVideo.y, 
    		m\_iNoOfColumn \* m\_iSizeVideo.x, m\_iNoOfRow \* m\_iSizeVideo.y);
    		glPushMatrix();
    
    		gluOrtho2D(-window\_width/4, window\_width/4, -window\_height/4, window\_height/4);
    		//glDrawPixels( window\_width/2,  window\_height/2, GL\_LUMINANCE,GL\_UNSIGNED\_BYTE, (void\*)m\_pbVideoData);
    		glLoadIdentity ();											// Reset The Projection Matrix
    
    		glDisable(GL\_TEXTURE\_GEN\_S);								// Enable Texture Coord Generation For S (NEW)
    		glDisable(GL\_TEXTURE\_GEN\_T);								// Enable Texture Coord Generation For T (NEW)
    
    		glDisable(GL\_LIGHTING);
    		glBegin(GL\_QUADS);											// Begin Drawing A Single Quad
    		// We Fill The Entire 1/4 Section With A Single Textured Quad.
    	
    		glTexCoord2f(1.0f, 1.0f); glVertex3f( 21.0f,  18.3f, -10.0f);
    		glTexCoord2f(0.0f, 1.0f); glVertex3f(-21.0f,  18.3f, -10.0f);
    		glTexCoord2f(0.0f, 0.0f); glVertex3f(-21.0f, -18.3f, -10.0f);
    		glTexCoord2f(1.0f, 0.0f); glVertex3f( 21.0f, -18.3f, -10.0f);
    		glEnd();	
    
    		glScalef(m\_fScale, m\_fScale, m\_fScale);
    		glRotated(m\_fRAngle\[0\],0.0, 0.0,1.0);
    		//glRotated(0,0.0,0.0, m\_fRAngle\[0\]);
    		//glRotated(0,0.0,0.0,m\_fRAngle\[0\]);	   
    
    		
    	}
    	else		
    	{
    		glPushMatrix();
    		glViewport(0, 0, window\_width, window\_height);
    		//float len = 28.0f;			
    		//glMatrixMode(GL\_PROJECTION);
    		glLoadIdentity();
    	//	glOrtho(-len, len, -len, len, -len\*100.0f, len\*100.0f);	
    	//	glMatrixMode(GL\_MODELVIEW);
    
    		glScalef(m\_fScale, m\_fScale, m\_fScale);
    		glRotated(m\_fRAngle\[0\],1.0, 0.0, 0.0);
    		glRotated(m\_fRAngle\[1\],0.0,1.0, 0.0);
    		glRotated(m\_fRAngle\[2\],0.0,0.0,1.0);	   
    
    
    	}
    	
    	
    }
    
    C / C++ / MFC graphics game-dev tutorial question

  • How to create multiple opengl view In same window?
    G GAJERA

    Hi all I have one Window with size of 700*700.The view size is 500*500 and 100*100 of Opengl. Now i am drawing some object on 500*500 opengl view. how i can draw same object on 100 *100 view without create any new object? means i want to use existing big view's object in Small view. Let me know how can we archive this thing. Thanks

    C / C++ / MFC graphics game-dev tutorial question

  • How to load 768*576 image in opengl ?
    G GAJERA

    int iwidth=512; int iHeight=512; OK,Now i am create image 512*512 and give in glTexImage2D

    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, iwidth,iHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, data);

    In Draw Function

    glTexSubImage2D (GL_TEXTURE_2D, 0, 0, 0,768, 576, GL_RGB, GL_UNSIGNED_BYTE, data);

    float fval=(float)(768.0f/512.0f);//.75f;
    if (TRUE) // Is Background Visible?
    {
    // Reset The Modelview Matrix
    glBegin(GL_QUADS); // Begin Drawing The Background (One Quad)
    // Front Face
    glTexCoord2f(fval, fval);
    glVertex3f( 11.0f, 8.3f, -20.0f);
    glTexCoord2f(0.0f, fval);
    glVertex3f(-11.0f, 8.3f, -20.0f);
    glTexCoord2f(0.0f, 0.0f);
    glVertex3f(-11.0f, -8.3f, -20.0f);
    glTexCoord2f(fval, 0.0f);
    glVertex3f( 11.0f, -8.3f, -20.0f);
    glEnd(); // Done Drawing The Background
    }

    I can not able to load image like above coding. By the way,My view size if fix 512*512 and i want to support zoom also.

    C / C++ / MFC announcement graphics question game-dev tutorial

  • How to load 768*576 image in opengl ?
    G GAJERA

    HI ALL I am trying to load image buffer and update image buffer per second . The function can load 256*256 image or 512*512 image but it can not load 768*576 image. I apply it with following function,Please let me know how can i load 768*576 image buffer?. int iwidth=768; int iHeight=512; unsigned char* data = 0; float angle=1.0f; BOOL CTestDlg::CreateWindowGL(HWND window) // This Code Creates Our OpenGL Window { DWORD windowStyle = WS_OVERLAPPEDWINDOW; // Define Our Window Style DWORD windowExtendedStyle = WS_EX_APPWINDOW; // Define The Window's Extended Style int iBitperPixel=16; PIXELFORMATDESCRIPTOR pfd = // pfd Tells Windows How We Want Things To Be { sizeof (PIXELFORMATDESCRIPTOR), // Size Of This Pixel Format Descriptor 1, // Version Number PFD_DRAW_TO_WINDOW | // Format Must Support Window PFD_SUPPORT_OPENGL | // Format Must Support OpenGL PFD_DOUBLEBUFFER, // Must Support Double Buffering PFD_TYPE_RGBA, // Request An RGBA Format iBitperPixel, // Select Our Color Depth 0, 0, 0, 0, 0, 0, // Color Bits Ignored 0, // No Alpha Buffer 0, // Shift Bit Ignored 0, // No Accumulation Buffer 0, 0, 0, 0, // Accumulation Bits Ignored 16, // 16Bit Z-Buffer (Depth Buffer) 0, // No Stencil Buffer 0, // No Auxiliary Buffer PFD_MAIN_PLANE, // Main Drawing Layer 0, // Reserved 0, 0, 0 // Layer Masks Ignored }; GLuint PixelFormat; // Will Hold The Selected Pixel Format CDC *pDc= GetDC(); // Grab A Device Context For This Window PixelFormat = ChoosePixelFormat (pDc->m_hDC, &pfd); // Find A Compatible Pixel Format if (SetPixelFormat (pDc->m_hDC, PixelFormat, &pfd) == FALSE) // Try To Set The Pixel Format { // Failed ReleaseDC (pDc); // Release Our Device Context // Zero The Window Handle return FALSE; // Return False } hRC = wglCreateContext (pDc->m_hDC); // Try To Get A Rendering Context // Make The Rendering Context Our Current Rendering Context if (wglMakeCurrent (pDc->m_hDC, hRC) == FALSE) return FALSE; glViewport (0, 0, (GLsizei)(iwidth), (GLsizei)(iHeight)); // Reset The Current Viewport glMatrixMode (GL_PROJECTION); // Select The Projection Matrix glLoadIdentity (); // Re

    C / C++ / MFC announcement graphics question game-dev tutorial

  • OpenGL and Live Video CDC.
    G GAJERA

    Hi all I have two view ,Opengl and Live Video (Which convert live video data to image and show on CDC). The 3D image draw in Opengl with different 3D point and draw in video CDC(convert 3D to 2D point). Here My problem is how to draw 3D image in 2D live video CDC?.It should be show like OPengl with different shade,color,Blending and all feature which is provide by OpenGL. AnyOne suggest the way for achive this thing. Thanks

    C / C++ / MFC graphics game-dev help tutorial question

  • How Inline and MACRO function are work?
    G GAJERA

    Though why we use MACRO and INLINE? or what is advantage of it. Is it right way to make general function instead of inline or MACRO?

    C / C++ / MFC question performance learning

  • How Inline and MACRO function are work?
    G GAJERA

    Hi All I read some text book .When we write definition of function in .h file.It's automatic a inline function consider by compiler. Though what should be exact size of Inline function.? MACRO:It is parsed by processor. what is difference between Inline and MACRO as speed and execution? Thanks

    C / C++ / MFC question performance learning

  • Query For CFileDialog?
    G GAJERA

    Override the CFileDialog http://www.codeguru.com/cpp/w-d/dislog/commondialogs/article.php/c1933[^]

    C / C++ / MFC help database question

  • Sleep Function
    G GAJERA

    Thanks

    C / C++ / MFC question

  • How can i get the name of windows mobile that is connected to pc?
    G GAJERA

    Good Luck

    C / C++ / MFC question

  • Number of instances running
    G GAJERA

    using EnumWindows API. Which is give the handle of running applications . Get window text from from CWnd * wnd and compare text with your application name.

    C / C++ / MFC question

  • Sleep Function
    G GAJERA

    OK,but How we stop sleep function? as we already put sleep for 1 hour.

    C / C++ / MFC question

  • Sleep Function
    G GAJERA

    But if you give sleep 1 hour, then what happen? I think it is not possible or we need to interrupt hardware.

    C / C++ / MFC question

  • How can i get the name of windows mobile that is connected to pc?
    G GAJERA

    Go to Solution Explorer->Properties for your project->C/C++->Code Generation->Runtime Library. See this document http://msdn.microsoft.com/en-us/library/2kzt1wy3%28VS.80%29.aspx[^]

    C / C++ / MFC question

  • Memory leakage Tool
    G GAJERA

    Thanks

    C / C++ / MFC c++ performance

  • Memory leakage Tool
    G GAJERA

    Hi All I am developing the VC++(MFC) base application using visulstudio 2008. Please suggest the best tool for find out the memory leakage from my application. Thanks In Advance

    C / C++ / MFC c++ performance

  • How can i get the name of windows mobile that is connected to pc?
    G GAJERA

    Check this MSDN forum http://social.msdn.microsoft.com/Forums/en-US/vssmartdevicesvbcs/thread/79169ed4-1153-472f-9051-fad3441a790b[^]

    C / C++ / MFC question

  • connection of SQL server to VC++6 MFC application
    G GAJERA

    Use this #define CONNECT_STRING _T("DSN=mmmmmmm;UID=sssssss; PWD=gggggg") m_pDBConn = new CDatabase(); BOOL w_bIsOpen = FALSE; if(m_pDBConn) { try { //opens a connection to the data source w_bIsOpen = m_pDBConn->OpenEx(CONNECT_STRING); }

    C / C++ / MFC question c++ database sql-server sysadmin
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups