Jump to content
  • Advertisement
Sign in to follow this  

My cubes faces see somewhat improper ,please tell solution.

This topic is 2085 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

i made this script to get a textured cube,but it returns what i have shown in picture.


#include "SOIL.h"
#include <gl/glut.h>
GLuint wall;

void Tex(int x,int y,GLuint tex){
void CubeTex(int l,int w,int h,GLuint texture){
    GLfloat normals[6][3] ={
    glVertex3f(0,h,0);    glTexCoord2f(1,0);    glVertex3f(l,h,0);    glTexCoord2f(1,1);    glVertex3f(l,0,0);    glTexCoord2f(0,1);    glVertex3f(0,0,0);//F1
    glVertex3f(0,0,0);glTexCoord2f(1,0);    glVertex3f(0,0,w);glTexCoord2f(1,1);    glVertex3f(0,h,w);glTexCoord2f(0,1);    glVertex3f(0,h,0);//F2
    glVertex3f(l,h,0);glTexCoord2f(1,0);glVertex3f(l,h,w);glTexCoord2f(1,1);glVertex3f(l,0,w);glTexCoord2f(0,1); glVertex3f(l,0,0);//F4
void display(){
//    glLoadIdentity();
//    Tex(20,20,wall);
void REanimation(){
int main(int argc, char** argv) {

    return 0;

Share this post

Link to post
Share on other sites

Backface culling issue.

You are calling




which tells GL to throw away all triangles (and you don't want this). But since culling is disabled by default, this call is meaningless.

What you need is


Which enables culling. The default mode is GL_BACK, so once you enable culling you are ready to go.


[EDIT] - BTW, i see that depth test is disabled as well. If all you drawing is a single box, this will work, but for multiple objects you need depth-test to get correct visibility.

Edited by satanir

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!