It is currently Sat Aug 19, 2017 2:25 am

All times are UTC - 5 hours




 Page 1 of 1 [ 10 posts ] 
Author Message
 Post subject: Mark all read
PostPosted: Tue Feb 13, 2007 7:04 am 
Site Admin

Joined: Sun Feb 11, 2007 8:59 am
Posts: 1105
Location: Ontario Canada
Added color information to the Triangle class from VMK 4 and made modifications to the engine. Created a simple 3D scene to be used in the next few VMK's.


Offline
 Profile  
 
 Post subject: no triangles displayed
PostPosted: Sun Mar 23, 2008 3:15 am 

Joined: Fri Jan 04, 2008 2:11 pm
Posts: 72
well in your vmk you changed/added some code towards the end of the vmk and the triangle was displayed but in my program it isn't shown...i'm trying to figure it out.


Offline
 Profile  
 
 Post subject:
PostPosted: Sun Mar 23, 2008 7:29 am 
Site Admin

Joined: Sun Feb 11, 2007 8:59 am
Posts: 1105
Location: Ontario Canada
A common reason why you will not see your triangle on the screen is because your triangle co-ordinates are incorrect. When you render objects on the screen, you need to make sure that the coordinates are defined in Counter Clockwise (CCW) order. This means that from your point of view, if you look at the triangles vertices V1, V2, V3, they should wrap in the CCW order.

Inside of the GameOGL::initalize function you will see that we have the following:
//enable backface culling
glCullFace( GL_BACK );
glEnable( GL_CULL_FACE );

This means that all triangles draw in the Clockwise (CW) winding order will be culled, meaning they will not appear on the screen.

Image


Offline
 Profile  
 
 Post subject: Re: GameDev VMK 6 - Scene Construction
PostPosted: Tue Apr 19, 2011 7:17 pm 

Joined: Thu Jul 10, 2008 6:04 am
Posts: 5
Hi Marek,

A question about ColorOGL and ConvertColor - I see that you're using integers (8-bits) to establish the colors. How does this convert correctly using the 16-bit display color scheme?

Thanks,
CD


Offline
 Profile  
 
 Post subject: Re: GameDev VMK 6 - Scene Construction
PostPosted: Tue Apr 19, 2011 8:09 pm 
Site Admin

Joined: Sun Feb 11, 2007 8:59 am
Posts: 1105
Location: Ontario Canada
ChesterDennis wrote:
I see that you're using integers (8-bits) to establish the colors. How does this convert correctly using the 16-bit display color scheme?


Each channel in OpenGL has 8 bits meaning that you have 256 colors of Red, 256 colors of Green, and 256 Colors for Blue. This gives you over 16 million colors to choose from. In addition, you also have 8bits (256) alpha values you can specify for each pixel.

16-bit color implies you only have 65536 different colors to choose from. Have a read here for details:

http://en.wikipedia.org/wiki/Color_depth


Offline
 Profile  
 
 Post subject: Re: GameDev VMK 6 - Scene Construction
PostPosted: Tue Apr 19, 2011 10:08 pm 

Joined: Thu Jul 10, 2008 6:04 am
Posts: 5
Hi Again,

I would agree if you're using 32-bit color in 32-bit graphics mode.

However, if we set the m_b32Bit variable to false, indicating 16-bit color, isn't putting 255 in red (aka 8 bits (for example)) invalid since 16-bit graphics can only take 4-6 bits for red, green, and blue (giving you the 65536 colors needed)? Also would the colors be off slightly if using the ConvertColor function?

CD


Offline
 Profile  
 
 Post subject: Re: GameDev VMK 6 - Scene Construction
PostPosted: Wed Apr 20, 2011 5:25 am 
Site Admin

Joined: Sun Feb 11, 2007 8:59 am
Posts: 1105
Location: Ontario Canada
Ahhh, I understand what you are asking now. I can't remember the last time that I used m_b32Bit = false, however if you do, then I would suggest that you use glColor3f to set the rgb values since OpenGL will then map the color space for you between 0.0f and 1.0f.

If you want to specify the colors using integers instead, then my though would be that you would need to look at PIXELFORMATDESCRIPTOR's cRedBits, cGreenBits, cBlueBits, and cAlphaBits to know which color space you are using and then you'll know what valid range of values [0 - 2^n] you are allowed to use.


Offline
 Profile  
 
 Post subject: Re: GameDev VMK 6 - Scene Construction
PostPosted: Mon Apr 20, 2015 1:05 am 

Joined: Sun Nov 23, 2014 2:38 am
Posts: 6
I'm obviously a bit late joining the bandwagon for this game project. However, I just wanted to note a different way to modify the color for the triangle over how Marek presented it in the video.

In the previous Video, Marek has us setting the colors directly to the vertices through OpenGL calls. Then in this video, he has us move the ColorGL to the triangle class so that we can set the color value to the whole triangle. By doing this, we color all the vertices the same, and lose the ability to color them independently in the Triangle class. Obviously we can still override this through the OpenGL glColorf calls as before. However, I made a few changes that allow us to keep individual vertex colors and the option to color the triangle thus preserving both cases.

I moved the ColorGL to the Vertex class (since the Vertex is what we want to color anyway), and added a ColorGL in the class to store the color value. I also create an optional (nullable) ColorGL* pointer in the Triangle constructor. (This was certainly good practice working with pointers!) If the pointer is Null, then nothing is done. If not, then the color of the vertices are overridden by the values contained within the ColorGL reference.

This way, you can have your cake and eat it too as it were. (I certainly don't expect my fix to survive as I'm sure there are better ways to do this.)

I look forward to finishing this video, and indeed all of the others to come!


Offline
 Profile  
 
 Post subject: Re: GameDev VMK 6 - Scene Construction
PostPosted: Fri Dec 18, 2015 3:15 am 

Joined: Wed Sep 30, 2015 3:10 am
Posts: 7
How does this convert correctly using the 16-bit display color scheme?
เทคนิคบาคาร่า


Offline
 Profile  
 
 Post subject: Re: GameDev VMK 6 - Scene Construction
PostPosted: Fri Dec 18, 2015 7:06 am 
Site Admin

Joined: Sun Feb 11, 2007 8:59 am
Posts: 1105
Location: Ontario Canada
Kanrased wrote:
How does this convert correctly using the 16-bit display color scheme?
เทคนิคบาคาร่า


See comments above in this thread


Offline
 Profile  
 
Display posts from previous:  Sort by  
 Page 1 of 1 [ 10 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


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

Jump to:  

cron