Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: OpenGL VB.NET
Hello Everyone,
 
I am a newbie to Opengl and I am using Tao framework in opengl.
 
I have read about hidden lien removal etc on various internet links but, I am not clear about the process.
 
Can some one please help me in understanding the process?
 
I have a simple starter code here:
 
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim hDC = Me.CreateGraphics.GetHdc
        glf.EnableOpenGL(hDC)
 
        Me.Show()
        Application.DoEvents()
        Dim z = -10.0F
 

        Gl.glShadeModel(Gl.GL_SMOOTH)
        Gl.glClearColor(0.0F, 0.0F, 0.0F, 0.0F)
        Gl.glClearDepth(1.0F)
        Gl.glEnable(Gl.GL_DEPTH_TEST)
        Gl.glDepthFunc(Gl.GL_LEQUAL)
        Gl.glHint(Gl.GL_PERSPECTIVE_CORRECTION_HINT, Gl.GL_NICEST)
 
        Gl.glMatrixMode(Gl.GL_PROJECTION)
        Gl.glLoadIdentity()
        Glu.gluPerspective(45.0F, Me.Width / Me.Height, 0.1, 1000)
        Gl.glMatrixMode(Gl.GL_MODELVIEW)
        Gl.glLoadIdentity()
 
        Gl.glClear(Gl.GL_DEPTH_BUFFER_BIT)
        Gl.glClear(Gl.GL_COLOR_BUFFER_BIT)Gl.glPushMatrix()
        Gl.glPushMatrix()
       'drawSquare()
        drawTriangle()
        Gl.glPopMatrix()
        Gl.glFlush()
        Gdi.SwapBuffers(hDC)
End Sub
 Public Function drawSquare()
        Dim z As Single = -5.0F
        Gl.glBegin(Gl.GL_POLYGON)
        Gl.glVertex3f(-1.0F, 1.0F, z)
        Gl.glVertex3f(1.0F, 1.0F, z)
        Gl.glVertex3f(1.0F, -1.0F, z)
        Gl.glVertex3f(-1.0F, -1.0F, z)
        Gl.glEnd()
        Return 0
    End Function
 
    Public Function drawTriangle()
        Dim z As Single = -4.0F
        Gl.glBegin(Gl.GL_POLYGON)
        'Gl.glColor3f(0.5F, 0.5F, 0.5F)
        Gl.glVertex3f(0.0F, 0.0F, z)
        Gl.glVertex3f(1.0F, 1.0F, z)
        Gl.glVertex3f(1.0F, -1.0F, z)
        Gl.glEnd()
        Return 0
    End Function
 

Now this code initializes the opengl window and makes a square and a triangle.
What I want to do is:
get the part of Square which is not overlapped by the triangle.
 
Can some one please guide me through this?
 
Thanks in advance,
Videep
Posted 19-Sep-12 2:18am
Edited 19-Sep-12 2:26am
(no name)177.6K
v2
Comments
DaveAuld at 19-Sep-12 7:26am
   
I have fixed your code block, you had an extra pre wrap which broke the formatting.
videepmishraa at 19-Sep-12 8:14am
   
Thank You

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 587
1 Sergey Alexandrovich Kryukov 519
2 Maciej Los 305
3 BillWoodruff 250
4 Mathew Soji 195
0 OriginalGriff 7,356
1 Sergey Alexandrovich Kryukov 6,777
2 DamithSL 5,461
3 Manas Bhardwaj 4,916
4 Maciej Los 4,475


Advertise | Privacy | Mobile
Web01 | 2.8.1411023.1 | Last Updated 19 Sep 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100