Results 1 to 6 of 6

Thread: panning pixmaps

  1. #1
    Guest

    panning pixmaps

    I have a pixmap (or in windows terminology, a colored 'bitmap'). I want to be able to pan the image to view different areas of it. I started to use glRaster2f(), but when the lower left hand corner of the image is off screen the image is not drawn. Alas there is no glBitmap() function to correct this. Is there a function that can do what I need or do I need to write a function to manipulate the bitmap bits themselves? Thanks,

    -Geo

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Jun 2000
    Location
    Gastonia, NC, USA
    Posts
    2,068

    Re: panning pixmaps

    Best way to pan a bitmap would be to apply it as a texture to a quad.

    Just move the quad around the window to pan it.


    Originally posted by GeoHoffman:
    I have a pixmap (or in windows terminology, a colored 'bitmap'). I want to be able to pan the image to view different areas of it. I started to use glRaster2f(), but when the lower left hand corner of the image is off screen the image is not drawn. Alas there is no glBitmap() function to correct this. Is there a function that can do what I need or do I need to write a function to manipulate the bitmap bits themselves? Thanks,

    -Geo

  3. #3
    Guest

    Re: panning pixmaps

    Thank you for your reply. What am I doing wrong in this code? All I see is a white square:


    void RenderScene1(void)
    {

    //set up viewport and the projection matrix. clear screen

    glViewport(20,80,500,500);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(0,500,0,500,100,-100);
    glEnable(GL_SCISSOR_TEST);
    glScissor(20,80,500,500);
    glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
    glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);

    //check for input and calculate new positions for scene objects
    getInput();


    //render the background
    glTexImage2D(GL_TEXTURE_2D, 0, 3, MainBitmapInfo->bmiHeader.biWidth,
    MainBitmapInfo->bmiHeader.biHeight,
    0,
    GL_BGR_EXT,
    GL_UNSIGNED_BYTE,
    MainBitmap);
    // glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S, GL_CLAMP );
    // glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T, GL_CLAMP );


    glBegin(GL_QUADS);
    glVertex3f(0,0,0);
    glVertex3f(0,500,0);
    glVertex3f(500,500,0);
    glVertex3f(500,0,0);
    glVertex3f(0,0,0);
    glEnd();

  4. #4
    Senior Member OpenGL Guru
    Join Date
    Jun 2000
    Location
    Gastonia, NC, USA
    Posts
    2,068

    Re: panning pixmaps

    Have you enable textures? glEnable( GL_TEXTURE_2D );

    also did you use glBindTexture( GL_TEXTURE_2D, texture_id );

  5. #5
    Senior Member OpenGL Pro
    Join Date
    Oct 2000
    Location
    Fargo, ND
    Posts
    1,753

    Re: panning pixmaps

    Should also set the mag and min filter with glTexParameter. The default minification filter is to use mipmaps, which you aren't doing here.
    Deiussum
    Software Engineer and OpenGL enthusiast

  6. #6
    Guest

    Re: panning pixmaps

    I did call glEnable(GL_TEXTURE_2D); prior to this code. But I did not call the glBindTexture() function. I will try that.

    The only problem that I forsee with using textures is that I believe the dimensions of textures all must be powers of 2. This is fine for smaller images but when they get bigger they REALLY grow fast and can waste alot of space. Also, does anyone know if there is a limit to the size of a texture. Am I correct to assume that textures are kept in memory on the video card when supported? Thank you all for your replies.

Similar Threads

  1. Transparent Grayscale Pixmaps
    By in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 03-27-2006, 01:14 AM
  2. pixmaps, glRasterPos, and rotation....help please
    By Rectless in forum OpenGL: Advanced Coding
    Replies: 6
    Last Post: 06-27-2005, 04:22 AM
  3. Pixmaps
    By tsewell in forum OpenGL: Linux
    Replies: 0
    Last Post: 12-16-2002, 03:12 AM
  4. HELP WITH PIXMAPS
    By Mark in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 08-23-2000, 11:35 AM
  5. HELP WITH PIXMAPS
    By Mark in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 08-21-2000, 09:19 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean