Jump to content
  • Advertisement
Sign in to follow this  
babarorhum

OpenGL Textures printed in Back Face, Front Face transparent and UV maps

This topic is 2492 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello everyone,

In a nutshell, i am using Blender 3D to export a cube with an associated UV map for texture three faces.
I have managed to bring up textures on a cube in OpenGL ES for learning how to apply textures.
However the result i get is the following:

  • front face of the cube appears transparent
  • textures are visible in the back face (inside the cube)
  • and faces which are not in the UV map they simply appear black.

    Do you know how to proceed to have the textures shown in the front faces and seeing these faces which are not subject to the UV map ?

    Many thanks in advance ! smile.png
    Cheers,
    Stéphane
    ps. attached screenshot to be more visual

Share this post


Link to post
Share on other sites
Advertisement
Problem Solved. I have added the following lines in my setupview :
[color=#734c2d]
[color=#450081]glEnable[color=#000000](GL_CULL_FACE[color=#000000]);[color=#450081]
glCullFace[color=#000000]([color=#734c2d]GL_FRONT[color=#000000]);
[color=#450081]
[color=#000000]and also changed in DrawArrays from GL_TRIANGE_STRIP to GL_TRIANGLES. Work perfectly now biggrin.png
[color=#450081]
[color=#000000]Cheers,[color=#450081]
[color=#000000]Stéphane

Share this post


Link to post
Share on other sites
A better solution would probably be to export the model with the faces going in the correct direction. Sounds like your model is wound backwards. I think this will give you problems later if you try to mess with lighting and normal vectors, as they are probably pointing in the wrong direction.

Exactly how to do this depends on the Blender version, but you probably want to look for something similar to "Flip Faces" or "Flip Normals".

Your solution may work for now, but it seems kind of backwards. Its not typical to render a model with front faces disabled (back faces disabled is more normal).

Share this post


Link to post
Share on other sites
Yea, basically you fixed it but its not proper and could lead to problems in certain shaders like when generating specular with relfecting vectors (not entirely sure). But you should be exporting the normals from Blender as well, because once you have smooth models like a sphere, each vertex will need a specific normal that you will need to export.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!