Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 6 of 6

Thread: texture , plane and a4

  1. #1
    Junior Member Regular Contributor
    Join Date
    Apr 2010
    Posts
    111

    texture , plane and a4

    hello.
    I have created a simple 3d engine for my purposes that support texture , vbo ecc....
    Now I would create an opengl project that displays scanned a4 documents .
    I think to use two triangles that form a rectangle , a plane, then set the scanned image as texture of the plane and send U and S coordinates in a VBO object with only vec3 position and a vec2 UV coordinates.

    What are the coordinates that i should use for the plane? pixel? and what is the width and the height?
    is sufficent set the width and the height of the plane as a4 for visualize an a4 at video?
    and whats are the dpi ? i must take them in consideration? or are only for print?
    Thanks.

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Jan 2012
    Location
    Australia
    Posts
    1,117
    If you want it at full size you will need to get the dpi of the screen (usually 96 but it doesn't have to be) and size a window to match an A4 doc; then use an ortho projection (glOrtho) to define the camera projection; the UV will be 0-1 and
    render a quad the size of the window.

    You should note that this not print quality - a printer will be 600-2400dpi.

  3. #3
    Junior Member Regular Contributor
    Join Date
    Apr 2010
    Posts
    111
    thanks.
    I must creating some a4 file image at hight scanner resolution, do the sobel filter in opencl, and visualize the sobel filter result in a windows of qt always in opengl.

    1)Is possible do the sobel filter on a hight resolution image that comes from the scanner?
    The dpi are more hight , then i can do a more precise filter.
    is correct?

    2)after the sobel filter i can display a texture(with the sobel filter result) in opengl at the resolution that i want, with a scale that mantains the proportions.and i use an ortho projection
    is possible?

  4. #4
    Senior Member OpenGL Pro
    Join Date
    Jan 2012
    Location
    Australia
    Posts
    1,117
    I don't know a lot about sobel filters other then basically how they work.
    Your biggest problem with filtering a very high resolution image is that you may not be able to
    allocate two texture buffers that big to do it inside OpenGL so filtering via OpenCL is probably the way to go -
    you will still need 2 buffers, one to read and one to write as the filter modifies a pixel based on the surrounding pixels.

    You can then scale the texture like I described which use a simply bilinear filter to render.

    But you may want to look a some sort of scaling at the OpenCL phase which can obviously be more sophisticated.

    In general OpenCL is designed for data manipulation whereas as OpenGL is really just for rendering.

  5. #5
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    3,216
    Quote Originally Posted by tonyo_au View Post
    Your biggest problem with filtering a very high resolution image is that you may not be able to
    allocate two texture buffers that big to do it inside OpenGL so filtering via OpenCL is probably the way to go -
    I would suggest implementing in pure OpenGL first (with basic shaders). Then, if you absolutely need more performance, consider use of GPU compute (GL compute shader, OpenCL, or CUDA). But be aware: it's more difficult to write GPU compute kernels well with maximal efficiency (and no bugs!).

    And I would definitely opt for a GL compute shader before I'd suggest OpenCL. Last time I checked, with OpenCL you still have to resort to the glFinish() / clFinish() sledgehammer approach to synchronization (cl_khr_gl_event / ARB_cl_event not supported). But GL compute shader is in the shading language we all know and love.

  6. #6
    Senior Member OpenGL Pro
    Join Date
    Jan 2012
    Location
    Australia
    Posts
    1,117
    And I would definitely opt for a GL compute shader before I'd suggest OpenCL
    I agree but how stable are the 4.3 drivers?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •