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

Thread: Texture problems

Hybrid View

  1. #1
    Newbie Newbie
    Join Date
    Dec 2012
    Posts
    3

    Texture problems

    I'm trying to do very simple rendering.
    My vertex buffer has 8 floats per vertex (3 for position, 3 for normal, 2 for texture)
    I'm drawing two triangles, each having its 3 vertices, but I'm getting one triangle drawing ok, and the other with strange results.

    These are the vertices (CCW, as required)
    -0.5,0.5,0,0,0,1,0,0
    0.5,-0.5,0,0,0,1,1,1
    0.5,0.5,0,0,0,1,1,0
    -0.5,0.5,0,0,0,1,0,0
    -0.5,-0.5,0,0,0,1,0,1
    0.5,-0.5,0,0,0,1,1,1

    and the indices are simply 0,1,2 and 3,4,5

    My texture is the test pattern:


    and the resulting rendering looks like:



    I would appreciate any idea on why this happens.

  2. #2
    Intern Contributor
    Join Date
    Dec 2012
    Posts
    74

    Can you paste your texture mapping code directly here?

    Quote Originally Posted by Photon View Post
    I'm trying to do very simple rendering.
    My vertex buffer has 8 floats per vertex (3 for position, 3 for normal, 2 for texture)
    I'm drawing two triangles, each having its 3 vertices, but I'm getting one triangle drawing ok, and the other with strange results.

    These are the vertices (CCW, as required)
    -0.5,0.5,0,0,0,1,0,0
    0.5,-0.5,0,0,0,1,1,1
    0.5,0.5,0,0,0,1,1,0
    -0.5,0.5,0,0,0,1,0,0
    -0.5,-0.5,0,0,0,1,0,1
    0.5,-0.5,0,0,0,1,1,1

    and the indices are simply 0,1,2 and 3,4,5

    My texture is the test pattern:


    and the resulting rendering looks like:



    I would appreciate any idea on why this happens.

    Can you paste your texture mapping code directly here?

  3. #3
    Intern Contributor
    Join Date
    Dec 2012
    Posts
    74
    Though you have described your problem abstractly right but paste some significant code is much persuasive and conveneint for test.

    Best regards,

    newbiecow

  4. #4
    Newbie Newbie
    Join Date
    Dec 2012
    Posts
    3
    After struggling with this for a long time, I did manage to find the cause, albeit by accident.
    I tried to run it on another machine and then got a link error from the shader program. The bug was that I defined an input to the fragment shader with an incorrect type (vec3 instead of vec2).

    It seems that my main machine (with nVidia 650m) simply ignored the problem and continued to generate this display. The other machine produced an error and then discovering the bug was trivial.

  5. #5
    Intern Contributor
    Join Date
    Dec 2012
    Posts
    74
    Quote Originally Posted by Photon View Post
    After struggling with this for a long time, I did manage to find the cause, albeit by accident.
    I tried to run it on another machine and then got a link error from the shader program. The bug was that I defined an input to the fragment shader with an incorrect type (vec3 instead of vec2).

    It seems that my main machine (with nVidia 650m) simply ignored the problem and continued to generate this display. The other machine produced an error and then discovering the bug was trivial.

    Very well! At least you found the cause and solved it!

Posting Permissions

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