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
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Geting MAX TEXTURE SIZE 1024 for a perticular pixel format?

Geting MAX TEXTURE SIZE 1024 for a perticular pixel format?

Scheduled Pinned Locked Moved C / C++ / MFC
questionperformancehelpworkspace
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Soumyadipta
    wrote on last edited by
    #1

    Different max texture size for PFD_DRAW_TO_BITMAP & PFD_DRAW_TO_WINDOW. Is there is any solution to get same max texture size? 1. I am using CreateDIBSection() for off screen rendering. 2. Which is working fine in my code as listed below. 3. But i am getting problem with textures as i am getting max texture size is 1024 4. I am getting desired 4096 texture size when i render to application window. 5. Pixel format of main application window and offscreen window is different. 6. The difference of pixel format and returned max texture size is mentioned below. How can i get 4096 max texture size for off screen window also? Getting 1024 max texture size PFD_DRAW_TO_BITMAP | PFD_SUPPORT_OPENGL | PFD_STEREO_DONTCARE, PFD_TYPE_RGBA, Getting 4096 max texture size PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER, PFD_TYPE_RGBA, What pixel format should i use to get 4096 max texture size.

    bool Create(unsigned int width, unsigned int height)
    {

    // Create a p-buffer for off-screen rendering
    
    m\_uiWidth = width;
    m\_uiHeight = height;
    
    m\_hWnd = g\_pMainApplicationWindow->GetHWND();		
    
    m\_hMainApplicationWindowDC = g\_pMainApplicationWindow->GetHDC();
    m\_hMainApplicationWindowRC = g\_pMainApplicationWindow->GetHGLRC();			
    
    memset(&m\_bmi, 0, sizeof(BITMAPINFO));
    m\_bmi.bmiHeader.biSize			= sizeof(BITMAPINFOHEADER);
    m\_bmi.bmiHeader.biWidth			= m\_uiWidth;
    m\_bmi.bmiHeader.biHeight		= m\_uiHeight;
    m\_bmi.bmiHeader.biPlanes		= 1;
    m\_bmi.bmiHeader.biBitCount		= 32;
    m\_bmi.bmiHeader.biCompression	= BI\_RGB;
    m\_bmi.bmiHeader.biSizeImage		= m\_uiWidth \* m\_uiHeight \* 4;
    
    // Create DIB
    HDC	hDC = ::GetDC(m\_hWnd);
    m\_hDib = ::CreateDIBSection(hDC, &m\_bmi, DIB\_RGB\_COLORS, (void\*\*)&m\_pTextureData, NULL, (DWORD)0);
    ReleaseDC(m\_hWnd, hDC);
    
    m\_hMemDC = ::CreateCompatibleDC(NULL);
    if(!m\_hMemDC)
    {
    	DeleteObject(m\_hDib);
    	m\_hDib = NULL;
    	return (false);
    }
    
    m\_hOldDib = SelectObject(m\_hMemDC, m\_hDib);
    
    // Setup memory DC's pixel format.
    if (!SetDCPixelFormat(m\_hMemDC, PFD\_DRAW\_TO\_BITMAP | PFD\_SUPPORT\_OPENGL | PFD\_STEREO\_DONTCARE))
    {
    	SelectObject(m\_hMemDC, m\_hOldDib);
    	DeleteObject(m\_hDib);
    	m\_hDib = NULL;
    	DeleteDC(m\_hMemDC);
    	m\_hMemDC = NULL;
    	return (false);
    }
    
    m\_hRC = ::wglCreateContext(m\_hMemDC);
    if (!m\_hRC)
    {
    	SelectObject(m\_hMemDC, m\_hOldDib);
    	DeleteObject(m\_hDib);
    	m\_hDib = NULL;
    	DeleteDC(m\_hMemDC);
    	m\_hMemDC = NULL;
    	return (fal
    
    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

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