Click here to Skip to main content
15,123,880 members
Home / Discussions / Graphics
   

Graphics

 
GeneralRe: graphics quality very poor, how to improve? Pin
Tino Fourie12-Jul-14 12:56
MemberTino Fourie12-Jul-14 12:56 
AnswerRe: graphics quality very poor, how to improve? Pin
Tino Fourie12-Jul-14 13:02
MemberTino Fourie12-Jul-14 13:02 
QuestionUseage about OPCODE collision detection Pin
Henry Hong4-Jun-13 16:23
MemberHenry Hong4-Jun-13 16:23 
AnswerRe: Useage about OPCODE collision detection - REPOST Pin
Richard MacCutchan4-Jun-13 23:03
mveRichard MacCutchan4-Jun-13 23:03 
GeneralRe: Useage about OPCODE collision detection - REPOST Pin
Henry Hong4-Jun-13 23:09
MemberHenry Hong4-Jun-13 23:09 
GeneralRe: Useage about OPCODE collision detection - REPOST Pin
Richard MacCutchan5-Jun-13 0:31
mveRichard MacCutchan5-Jun-13 0:31 
QuestionOpenGL 3.0 Square is being drawn behind another Square Pin
mrpeed1-May-13 13:51
Membermrpeed1-May-13 13:51 
AnswerRe: OpenGL 3.0 Square is being drawn behind another Square Pin
Santhosh G_27-May-13 7:23
MemberSanthosh G_27-May-13 7:23 
Enable Depth test to draw objects beyond others.
glEnable( GL_DEPTH_TEST );
glDepthFunc( GL_LESS ); // Near objects will be displayed. object with z -3 displayed on top of object with z -4

If you are creating an app similar to MSPAINT, setup projection matrix with glOrtho().
glOrtho() is used because it creates an orthographic projection, therefore the size of rendered image of same size with different z value will be same.

Provide different z values for each objects, based on their z order in the screen.
ie, z value of the object drawn at first should be as small, say 1.
Then increase z value of each new objects.

Render code should be like this.
C#
// set depth range and clear depth value.
glDepthRange(-100, 100);
glClearDepth(100);
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);

// Set projection.
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glOrtho(-20,20,-20,20,0, 100 );

glEnable( GL_DEPTH_TEST );
glDepthFunc( GL_LESS );

// No model view transformation.
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();

// Draw object 1
glColor3f(0,0,1);
glBegin( GL_TRIANGLES );
glVertex3f( 0,0, -3 );
glVertex3f( 1,1, -3 );
glVertex3f( 0,1, -3 );
glEnd();

// Draw Object 2. Here z is -2, it will be displayed on top of object -3
glColor3f(1,0,0);
glBegin( GL_TRIANGLES );
glVertex3f( 0,1, -2 );
glVertex3f( 1,1, -2 );
glVertex3f( 1,0, -2 );
glEnd();

SwapBuffers( m_hDC );

QuestionGestures, jestures, and swipes - implementation fundamentals Pin
charlieg10-Apr-13 12:51
Membercharlieg10-Apr-13 12:51 
AnswerRe: Gestures, jestures, and swipes - implementation fundamentals Pin
Pete O'Hanlon10-Apr-13 13:14
mvePete O'Hanlon10-Apr-13 13:14 
GeneralRe: Gestures, jestures, and swipes - implementation fundamentals Pin
charlieg11-Apr-13 0:23
Membercharlieg11-Apr-13 0:23 
GeneralRe: Gestures, jestures, and swipes - implementation fundamentals Pin
Pete O'Hanlon11-Apr-13 0:34
mvePete O'Hanlon11-Apr-13 0:34 
GeneralRe: Gestures, jestures, and swipes - implementation fundamentals Pin
charlieg11-Apr-13 0:53
Membercharlieg11-Apr-13 0:53 
GeneralRe: Gestures, jestures, and swipes - implementation fundamentals Pin
Pete O'Hanlon11-Apr-13 1:03
mvePete O'Hanlon11-Apr-13 1:03 
GeneralRe: Gestures, jestures, and swipes - implementation fundamentals Pin
charlieg11-Apr-13 1:16
Membercharlieg11-Apr-13 1:16 
GeneralRe: Gestures, jestures, and swipes - implementation fundamentals Pin
Pete O'Hanlon11-Apr-13 1:19
mvePete O'Hanlon11-Apr-13 1:19 
Question3D C# windows from Pin
taufiki8-Feb-13 1:06
Membertaufiki8-Feb-13 1:06 
AnswerCrosspost Pin
Eddy Vluggen8-Feb-13 1:27
professionalEddy Vluggen8-Feb-13 1:27 
AnswerRe: 3D C# windows from Pin
MaulikDusara26-Jun-13 10:04
MemberMaulikDusara26-Jun-13 10:04 
QuestionThick Line Algorithm Pin
A_Fa5-Jan-13 21:56
MemberA_Fa5-Jan-13 21:56 
AnswerRe: Thick Line Algorithm Pin
UweKlatt18-Jan-13 2:50
MemberUweKlatt18-Jan-13 2:50 
GeneralRe: Thick Line Algorithm Pin
Ingo30-Jan-13 3:29
MemberIngo30-Jan-13 3:29 
AnswerRe: Thick Line Algorithm Pin
Ingo30-Jan-13 3:28
MemberIngo30-Jan-13 3:28 
AnswerRe: Thick Line Algorithm Pin
TheRealRarius21-Mar-13 1:35
MemberTheRealRarius21-Mar-13 1:35 
AnswerRe: Thick Line Algorithm Pin
Brian J Rothwell12-Aug-14 13:24
MemberBrian J Rothwell12-Aug-14 13:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.