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 2 of 2

Thread: Generation of 3d mesh using glvertex

  1. #1
    Junior Member Newbie
    Join Date
    Nov 2018
    Posts
    5

    Generation of 3d mesh using glvertex

    I loaded the '.tiff' image and displayed it on the screen.(Using MFC)

    Because the coordinate system of OpenGL increases the x-axis from -1 to 1 and the y-axis decreases from 1 to -1 (Total length: 2) I made the x- and y-coordinate by dividing the horizontal value of 2.

    For example, if the image was 50x50, then 2/50 was used to obtain each coordinate value.

    Then, I drew the image in two dimensions on the screen using glvertex and glcolor.

    I want to make this a three-dimensional mesh by adjusting the z-values of the glvertex (x,y,z).

    The current x and y values are in the form of GLFLOAT and are extremely small numbers below one.
    ( ex) x : 0.002198, y : 0.002234)

    I have tried adding z-values to the glvertex at random, but 3D mesh does not form. What the hell's the matter?

    I shall appreciate any advice

    Thank you

  2. #2
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    4,569
    Quote Originally Posted by Hurricane_RusH View Post
    Because the coordinate system of OpenGL increases the x-axis from -1 to 1 and the y-axis decreases from 1 to -1 (Total length: 2) I made the x- and y-coordinate by dividing the horizontal value of 2.
    This is the default convention for the NDC coordinate space. You don't typically provide vertex positions in this coordinate space, but instead in object-space or world-space. Sounds like you need to read the Viewing chapter of the OpenGL Programming Guide.

    I have tried adding z-values to the glvertex at random, but 3D mesh does not form. What the hell's the matter?
    Do you have a perspective projection active? Are you providing vertices which are inside the eye-space view frustum for that perspective projection transform?

Posting Permissions

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