Welcome Guest ( Log In | Register )

[ Big| Medium| Small] -



Post new topic Reply to topic  [ 2 posts ] 
    Amy
  Thu Apr 05, 2012 3:18 pm
User avatar
Staff

Big Dumb Guy
I have created a cube which is textured, and I am calling this function to create different cubes.

One of these is a skybox, so the player sees the inside of the cube, this works perfectly.

Others are buildings and things, these end up looking like this: (the sky is the skybox)

Image

The second texture is supposed to appear as a checkerboard - and it does when applied to the skybox:

Image

But remember, the skybox is just the same cube drawn larger so the player only sees the inside...

I'm wondering if anyone knows why, is there something obvious I'm missing as to why it only works on the inside of boxes?

This is the code for my cube:

Expand to see the code.


Is there a flag or something I need to change to specify whether it's drawn on the inside or outside of the box? That's the only difference I can think of.

The skybox is drawn by:

drawBox(80, texName[2]);


The other boxes:

drawBox(1, texName[2]);


Top Top
Profile      
 

    Amy
  Thu Apr 05, 2012 4:08 pm
User avatar
Staff

Big Dumb Guy
I feel stupid, but in case anybody else gets this problem, this is the solution:


In your draw method:

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);



In your init method:

glEnable(GL_DEPTH_TEST);


Google GL_DEPTH_TEST for settings you can apply to it.


Top Top
Profile      
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 


Who is online

Users browsing this forum: No users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

We are an independent, not-for-profit game making community.
Homepage
Board Index
About Us
Downloadable Games
Free Browser Games
Games in Development
RPG Maker Support
Game Maker Support
Construct 2 Support
HBGames the eZine
Advanced RPG Maker
Site Announcements
Powered by phpBB © phpBB Group