Jump to content
  • Advertisement

Ali_nz

Member
  • Content Count

    36
  • Joined

  • Last visited

Community Reputation

122 Neutral

About Ali_nz

  • Rank
    Member
  1. Ali_nz

    Transparency Woes...

    Fixed it - JPS compression meant that black was not really black!! -Al
  2. Hi Guys, I am trying to get my image, which has a black background to be transparent. Umm, not working at the moment. Also when I use the line: compassTexture = TextureLoader.FromFile(device, "HSI.jpg", 0, 0, 1, Usage.Dynamic, Format.A8R8G8B8, Pool.Default, Filter.None, Filter.None, Color.Black.ToArgb()); Instead of: compassTexture = TextureLoader.FromFile(device, "HSI.jpg"); For some reason my texture now rotates around a point other than the center of the image?? Would love any pointers on what might be casuing this. Thanks -Al using System; using System.Drawing; using System.Windows.Forms; using Microsoft.DirectX; using Microsoft.DirectX.Direct3D; using Direct3D=Microsoft.DirectX.Direct3D; namespace MatricesTutorial { public class Matrices : Form { // Our global variables for this project Device device = null; // Our rendering device VertexBuffer vertexBuffer = null; PresentParameters presentParams = new PresentParameters(); bool pause = false; Texture compassTexture = null; public Matrices() { // Set the initial size of our form this.ClientSize = new System.Drawing.Size(400,300); // And it's caption this.Text = "Direct3D Tutorial 3 - Matrices"; } public bool InitializeGraphics() { try { // Now let's setup our D3D stuff presentParams.Windowed=true; presentParams.SwapEffect = SwapEffect.Discard; device = new Device(0, DeviceType.Hardware, this, CreateFlags.SoftwareVertexProcessing, presentParams); device.DeviceReset += new System.EventHandler(this.OnResetDevice); this.OnCreateDevice(device, null); this.OnResetDevice(device, null); pause = false; return true; } catch (DirectXException) { return false; } } public void OnCreateDevice(object sender, EventArgs e) { Device dev = (Device)sender; // Now Create the VB vertexBuffer = new VertexBuffer(typeof(CustomVertex.PositionTextured), 6, dev, 0, CustomVertex.PositionTextured.Format, Pool.Default); vertexBuffer.Created += new System.EventHandler(this.OnCreateVertexBuffer); this.OnCreateVertexBuffer(vertexBuffer, null); device.RenderState.AlphaBlendEnable = true; device.SamplerState[0].AddressU = TextureAddress.Clamp; device.SamplerState[0].AddressV = TextureAddress.Clamp; device.SamplerState[0].AddressW = TextureAddress.Clamp; } public void OnResetDevice(object sender, EventArgs e) { Device dev = (Device)sender; // Turn off culling, so we see the front and back of the triangle dev.RenderState.CullMode = Cull.None; // Turn off D3D lighting, since we are providing our own vertex colors dev.RenderState.Lighting = false; } public void OnCreateVertexBuffer(object sender, EventArgs e) { //compassTexture = TextureLoader.FromFile(device, "HSI.jpg"); compassTexture = TextureLoader.FromFile(device, "HSI.jpg", 0, 0, 1, Usage.Dynamic, Format.A8R8G8B8, Pool.Default, Filter.None, Filter.None, Color.Black.ToArgb()); VertexBuffer vb = (VertexBuffer)sender; CustomVertex.PositionTextured[] verts = (CustomVertex.PositionTextured[])vb.Lock(0,0); verts[0] = new CustomVertex.PositionTextured(-1.0f, -1.0f, 0.0f, 0.0f, 1.0f); verts[1] = new CustomVertex.PositionTextured(-1.0f, 1.0f, 0.0f, 0.0f, 0.0f); verts[2] = new CustomVertex.PositionTextured(1.0f, -1.0f, 0.0f, 1.0f, 1.0f); verts[3] = new CustomVertex.PositionTextured(1.0f, -1.0f, 0.0f, 1.0f, 1.0f); verts[4] = new CustomVertex.PositionTextured(1.0f, 1.0f, 0.0f, 1.0f, 0.0f); verts[5] = new CustomVertex.PositionTextured(-1.0f, 1.0f, 0.0f, 0.0f, 0.0f); //verts[0].X=-1.0f; verts[0].Y=-1.0f; verts[0].Z=0.0f; //verts[1].X=1.0f; verts[1].Y=-1.0f ;verts[1].Z=0.0f; //verts[2].X=1.0f; verts[2].Y=1.0f; verts[2].Z = 0.0f; //verts[3].X = -1.0f; verts[3].Y = -1.0f; verts[3].Z = 0.0f; //verts[4].X = 1.0f; verts[4].Y = 1.0f; verts[4].Z = 0.0f; //verts[5].X = -1.0f; verts[5].Y = 1.0f; verts[5].Z = 0.0f; vb.Unlock(); } private void Render() { if (device == null) return; if (pause) return; //Clear the backbuffer to a blue color device.Clear(ClearFlags.Target, System.Drawing.Color.Gray, 1.0f, 0); //Begin the scene device.BeginScene(); // Setup the world, view, and projection matrices SetupMatrices(); device.SetTexture(0, compassTexture); device.SetStreamSource(0, vertexBuffer, 0); device.VertexFormat = CustomVertex.PositionTextured.Format; device.DrawPrimitives(PrimitiveType.TriangleList, 0, 2); //End the scene device.EndScene(); device.Present(); } private void SetupMatrices() { // For our world matrix, we will just rotate the object about the y-axis. // Set up the rotation matrix to generate 1 full rotation (2*PI radians) // every 1000 ms. To avoid the loss of precision inherent in very high // floating point numbers, the system time is modulated by the rotation // period before conversion to a radian angle. int iTime = Environment.TickCount % 1000; float fAngle = iTime * (2.0f * (float)Math.PI) / 1000.0f; device.Transform.World = Matrix.RotationZ( fAngle ); // Set up our view matrix. A view matrix can be defined given an eye point, // a point to lookat, and a direction for which way is up. Here, we set the // eye five units back along the z-axis and up three units, look at the // origin, and define "up" to be in the y-direction. device.Transform.View = Matrix.LookAtLH( new Vector3( 0.0f, 0.0f,-3f ), new Vector3( 0.0f, 0.0f, 0.0f ), new Vector3( 0.0f, 1.0f, 0.0f ) ); // For the projection matrix, we set up a perspective transform (which // transforms geometry from 3D view space to 2D viewport space, with // a perspective divide making objects smaller in the distance). To build // a perpsective transform, we need the field of view (1/4 pi is common), // the aspect ratio, and the near and far clipping planes (which define at // what distances geometry should be no longer be rendered). device.Transform.Projection = Matrix.PerspectiveFovLH( (float)Math.PI / 4, 1.3f, 1.0f, 100.0f ); } protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) { this.Render(); // Render on painting } protected override void OnKeyPress(System.Windows.Forms.KeyPressEventArgs e) { if ((int)(byte)e.KeyChar == (int)System.Windows.Forms.Keys.Escape) this.Close(); // Esc was pressed } protected override void OnResize(System.EventArgs e) { pause = ((this.WindowState == FormWindowState.Minimized) || !this.Visible); } /// <summary> /// The main entry point for the application. /// </summary> static void Main() { using (Matrices frm = new Matrices()) { if (!frm.InitializeGraphics()) // Initialize Direct3D { MessageBox.Show("Could not initialize Direct3D. This tutorial will exit."); return; } frm.Show(); // While the form is still valid, render and process messages while(frm.Created) { frm.Render(); Application.DoEvents(); } } } } }
  3. All sorted now - thanks guys. -Al
  4. PS: I am not using indices - my project at this stage is very simple. Cheers -Al
  5. I am pretty new at this so please bear with me. Stil not sure whats casuing it to draw backwards? Do I have to draw the verts clockwise? Does the second triangle have to start off with the last vert of the previous one? Cheers -Al
  6. Hi guys,. I have made my first textured quad from two tri's! Yay! Only problem is the last triangle has the texture the wrong way around. I thought I applied the texture coords right? Anyone able to offer a solution? Thanks -Al public void OnCreateVertexBuffer(object sender, EventArgs e) { compassTexture = TextureLoader.FromFile(device, "HSI.jpg"); VertexBuffer vb = (VertexBuffer)sender; CustomVertex.PositionTextured[] verts = (CustomVertex.PositionTextured[])vb.Lock(0,0); verts[0] = new CustomVertex.PositionTextured(-1.0f, -1.0f, 0.0f, 0.0f, 1.0f); verts[1] = new CustomVertex.PositionTextured(-1.0f, 1.0f, 0.0f, 0.0f, 0.0f); verts[2] = new CustomVertex.PositionTextured(1.0f, -1.0f, 0.0f, 1.0f, 1.0f); verts[3] = new CustomVertex.PositionTextured(1.0f, -1.0f, 0.0f, 1.0f, 0.0f); verts[4] = new CustomVertex.PositionTextured(1.0f, 1.0f, 0.0f, 1.0f, 1.0f); verts[5] = new CustomVertex.PositionTextured(-1.0f, 1.0f, 0.0f, 0.0f, 1.0f); //verts[0].X=-1.0f; verts[0].Y=-1.0f; verts[0].Z=0.0f; //verts[1].X=1.0f; verts[1].Y=-1.0f ;verts[1].Z=0.0f; //verts[2].X=1.0f; verts[2].Y=1.0f; verts[2].Z = 0.0f; //verts[3].X = -1.0f; verts[3].Y = -1.0f; verts[3].Z = 0.0f; //verts[4].X = 1.0f; verts[4].Y = 1.0f; verts[4].Z = 0.0f; //verts[5].X = -1.0f; verts[5].Y = 1.0f; verts[5].Z = 0.0f; vb.Unlock(); }
  7. Hi All, On the following line how do I specify a RBG color? Thanks -Al verts[5].X = 50; verts[5].Y = 250; verts[5].Z = 0.5f; verts[5].Rhw = 1; verts[5].Color = System.Drawing.Color.LightPink.ToArgb();
  8. Hi Guys, I have been writing a little project that requires text. I have been using OGL and C#. I have been learning by mainly ripping code from NeHe's tutorials, but I notice that there is no sample code for C3 that relates to text in OGL. Does anyone have some base code for this? Cheers -Al
  9. Ali_nz

    Compass & GPS project

    Hmmm, I tried wrapping my call to drawglscene() in a for loop that had something like for (count=1;count<300;count++) { drawglscene } and then in drawglscene was using count for the rotate value but it didnt appear to work. I wonder if it drew so quick that I didnt see it? -Al
  10. Hi Folks, I am trying to write a program for a real world project, although the maths could easily be applied to gaming projects too. I am using openGL and VC++ Express. What I am trying to do is make a instrument for a pilot in a aeroplane to fly a search pattern, like what you would do for a missing people at sea. The search pattern i want to impliment initally is a creeping line search pattern which looks like so: (2)-----<----* | | *------>-----* | | *-----<-----(1) The search pattern is general defined by Map Grid coordinates of the two corners of a box (1) and (2). And a sweep width, which is not shown above, but is the vertical spacing in my diagram. Note that although my picture is aligned with the x/y axis the box could be offset to any angle. The problem is coming up with an algorithm definging the turning points (*) If anyone can help out here I would be really grateful. I have kinda hashed the maths of it on some paper, but wouldnt really know how to get it into code. Cheers -AL
  11. Hi Folks, I have been accused of coming up with some interesting projects. Heres another one: I am writing a little program to display a graphical compass using opengl. The source data about headings etc comes from a library I am using which allows you to connect to a GPS. I have two problems tho: 1. The GPS I have can update the heading 5 times per second, yet the openGL can update at about 60 times a second. Whats a good way to avoid calling the GPS routine unnessecarily? 2. In theory, the GPS could give a heading of say 050, then the next reading might be 065. To simulate a real world compass, and to look good, opengl wants to rotate smootly (albiet very fast) so I guess I need a if loop with roatate1 being the start value until hit reaches rotate2 and then rotate1 needs to take on the next compass reading and loop from rotate2 until it hits rotate1 value again? Could someone please try to formalise this logic for me please? Thanks heaps in advance, -Al
  12. Hi folks, I wrote a OpenGL program which simulates an Artifical Horizon, which is a instrument in an aircraft cockpit. I have a gyro sensor attached to the Serial port on my computer which gives me orientation data (Euler angles) in 3D. I had a crack at using the sensor data to control the artifical horizon I made, but it didnt like the repeated calls to the GetData() function that I copied from the software SDK, and after a few seconds the program would crash with: Unhandled Exeption: Access Violation. I put the GetData function in DrawGLScene part of my code. (GetData calls two other functions to do with setting up the Serial connection). I will past the code from the SDK below, and would very much appreciate it if someone could show me how to get the euler angles from the matrix into OpenGl without crashing my program. I am still a bit green at all this, but quite enjoying it, albeit a steep learning curve! Thanks -Al #include <conio.h> // Needed for _kbhit function #include <stdio.h> // Needed for printf etc #include <objbase.h> // Needed for COM functionality // import functions in MT object #include "IMTObj.h" // GUIDs of MT object #include "IMTObj_i.c" // return values for MT_GetOrientation function #define MT_NEWDATA 1 #define MT_NODATA 2 #define MT_NOSENSORID 3 #define MT_INCOMPLETE 4 #define MT_CHECKSUMERROR 5 #define MT_NOPORT 6 #define MT_NOCALIBVALUES 7 #define MT_POWERLOSS 8 // output possiblities for MT object #define MT_LOGQUATERNION 0 #define MT_LOGEULER 1 #define MT_LOGROTMATRIX 2 // Global pointer to the MTObj COM Interface IMotionTracker* pMT; // Output data format short g_nMode = MT_LOGEULER; void SetupFilter() { // Set MTObj COM object options short bLogCalibratedData = FALSE; // Set MTObj COM object variables float fGain = 1.0; short nCorInterval = 1; float fRho = 1.0; short nPortNumber; printf("Enter COM port: "); scanf("%d", &nPortNumber); // Create instance of MTObj COM object printf("Create instance of MotionTracker object..."); HRESULT hRes = CoCreateInstance(CLSID_MotionTracker, NULL, CLSCTX_SERVER, IID_IMotionTracker, (void**) &pMT); if (FAILED(hRes)) { printf("Error %x in CoCreateInstance for MT object!",hRes); return; } else printf("done\n\n"); printf("Setting filter parameters..."); // Optional settings pMT->MT_SetCalibratedOutput(bLogCalibratedData); // Set Gain, Correction interval and Rho pMT->MT_SetFilterSettings(fGain,nCorInterval,fRho); // Required settings pMT->MT_SetOutputMode(g_nMode); // Set COM port number where MotionTracker is attached pMT->MT_SetCOMPort(nPortNumber); printf("done\n\n"); } BOOL GetData() { float fOrientationData[9] = {0}; VARIANT OrientationBuffer; void* pDest; short nNew = 0; BOOL bNewData = FALSE; pMT->MT_GetOrientationData(&nNew, &OrientationBuffer); if (nNew == MT_NEWDATA) { // Check if array is not empty if (OrientationBuffer.vt != VT_EMPTY) { // Retrieve pointer to array data HRESULT hr = SafeArrayAccessData(OrientationBuffer.parray, &pDest); // One dimensional array. Get the bounds for the array. if (SUCCEEDED(hr)) { __try{ // Copy data from the VARIANT array to the local fData array memcpy(fOrientationData,pDest,(OrientationBuffer.parray->rgsabound->cElements * sizeof(float))); bNewData = TRUE; } __except(GetExceptionCode() == STATUS_ACCESS_VIOLATION){ bNewData = FALSE; } SafeArrayUnaccessData(OrientationBuffer.parray); // Invalidate pointer // Variant must be cleared. This also destroys the SafeArray VariantClear(&OrientationBuffer); // fOrientationData now contains orientation data is bNewData = true // Can be logged to file or written to screen (see below) if (g_nMode == MT_LOGEULER) { printf("%f %f %f\n",fOrientationData[0],fOrientationData[1],fOrientationData[2]); } bNewData = FALSE; return TRUE; } else return FALSE; } else return FALSE; } else if (nNew != 0) { // Check if error was reported by MotionTracker object switch(nNew) { case MT_NODATA: printf("No Data On COM Port\n\n"); break; case MT_NOSENSORID: printf("No Sensor ID Received From Sensor\n\n"); break; case MT_INCOMPLETE: printf("Incomplete Data Received (Connection Lost)\n\n"); break; case MT_CHECKSUMERROR: printf("Checksum Error\n\n"); break; case MT_NOPORT: printf("COM Port Could Not Be Opened\n\n"); break; case MT_NOCALIBVALUES: printf("XMU File With Calibration Data Could Not Be Read or \nMTS Data With Calibration Data Not Set\n\n"); break; case MT_POWERLOSS: printf("Power Supply To The Sensor Was Probably Interupted\n\n"); break; } return FALSE; } else return TRUE; } int main(int argc, char* argv[]) { // Initialize COM library printf("Initialize COM library..."); if (CoInitialize(NULL) != S_OK) printf("Failed to initialize COM library"); else printf("done\n\n"); // Create filter instance and set filter parameters SetupFilter(); // Start processing by MotionTracker object printf("Start processing by the MotionTracker object.."); pMT->MT_StartProcess(); printf("done\n\n"); // Keep receiving data as long as no error is received // Diconnect the MotionTracker to stop the program nicely BOOL bKeepRunning = TRUE; while (bKeepRunning == TRUE && !_kbhit()) bKeepRunning = GetData(); // Stop processing by MotionTracker object printf("Stopping filter..."); pMT->MT_StopProcess(); printf("done\n\n"); // Release and clean up MotionTracker object printf("Release MotionTracker object..."); if (pMT != NULL) { pMT->Release(); pMT = NULL; printf("done\n\n"); } // Uninitialize COM library printf("Uninitialize COM library..."); CoUninitialize(); printf("done\n\n"); return 1; }
  13. Yeah - you could be right about the motion tracker.... Will dig a bit deeper...... Cheers -Al
  14. True - however all that stuff is remarked out - and the error still happens. I accept that the error you pointed out is still not good tho!
  15. Hi Guys, I am getting a unhandled exception : access violation. Had a bit of a read on this site about it and read the article on debugging. Even had Superpig, try to help me on irc figure out what was going wrong. Still havent fixed it, but this is where I am at: My program runs for a little while, draws the graphics on screen, but after a few seconds throws the above error. int DrawGLScene(GLvoid) // Here's Where We Do All The Drawing { int i; GLfloat radius_1=1.8f; GLfloat radius_2=2.0f; GLfloat radius_3=2.2f; //////////XSENS STUFF ////////////// GetData(); /////////////////////////////////// glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear Screen And Depth Buffer glLoadIdentity(); // Reset The Current Modelview Matrix glTranslatef(0.0f,0.0f,-7.0f); //**** Disable texturing glDisable(GL_TEXTURE_2D); // glPushMatrix(); //1 push glRotatef(fOrientationData[0],0.0f,0.0f,1.0f); glTranslatef(0.0f,(fOrientationData[1]/18.0)+0.0f,0.0f); //**** Blue/Brown of Horizon glBegin(GL_QUADS); glColor3f(0.0f, 0.6f, 0.796f); glVertex3f(-6.0f, 18.0f, 0.0f); // Top Left glVertex3f( 6.0f, 18.0f, 0.0f); // Top Right glVertex3f( 6.0, 0.0f, 0.0f); // Bottom Right glVertex3f(-6.0f, 0.0f, 0.0f); // Bottom Left glColor3f(0.694f, 0.4f, 0.0f); glVertex3f(-6.0f, -18.0f, 0.0f); // Top Left glVertex3f( 6.0f, -18.0f, 0.0f); // Top Right glVertex3f( 6.0f, 0.0f, 0.0f); // Bottom Right glVertex3f(-6.0f, 0.0f, 0.0f); // Bottom Left glEnd(); //**** Horizon Lines for (lines=-18; lines<19; lines++) { glBegin(GL_LINES); glColor3f(1.0f, 1.0f, 1.0f); // Sets Color White glVertex3f(-6.0f, 0.0f, 0.0f); //Level glVertex3f(6.0f, 0.0f, 0.0f); glVertex3f(-0.75f, lines+1.0f, 0.0f); //10 UP glVertex3f(0.75f, lines+1.0f, 0.0f); glVertex3f(-0.25f, lines+0.75f, 0.0f); // --- glVertex3f(0.25f, lines+0.75f, 0.0f); glVertex3f(-0.5f, lines+0.5f, 0.0f); //---===--- glVertex3f(0.5f, lines+0.5f, 0.0f); glVertex3f(-0.25f, lines+0.25f, 0.0f); // --- glVertex3f(0.25f, lines+0.25f, 0.0f); glEnd(); } /* //***** Font Stuff ****** glPushMatrix(); // 2 push glColor3f(1.0f,1.0f,1.0f); glTranslatef(-1.1f,-0.1f,0.0f); for (i=10;i<90;i=i+10) { stringstream ss; ss << i; glTranslatef(0.0f,1.0f,0.0f); glPrint(ss.str().c_str()); } glPopMatrix(); glTranslatef(0.8f,-0.1f,0.0f); for (i=10;i<190;i=i+10) { stringstream ss; ss << i; glTranslatef(0.0f,1.0f,0.0f); glPrint(ss.str().c_str()); } glPopMatrix(); */ /* // WINGS glBegin(GL_QUADS); glColor3f(0.0f,0.0f,0.0f); glVertex3f(-1.75f,0.075f,0.0f); //LEFT glVertex3f(-0.75f,0.075f,0.0f); glVertex3f(-0.75f,-0.075f,0.0f); glVertex3f(-1.75f,-0.075f,0.0f); glVertex3f(-0.75f,-0.075f,0.0f); glVertex3f(-0.75f,-0.175f,0.0f); glVertex3f(-0.875f,-0.175f,0.0f); glVertex3f(-0.875f,-0.075f,0.0f); glVertex3f(1.75f,0.075f,0.0f); //RIGHT glVertex3f(0.75f,0.075f,0.0f); glVertex3f(0.75f,-0.075f,0.0f); glVertex3f(1.75f,-0.075f,0.0f); glVertex3f(0.75f,-0.075f,0.0f); glVertex3f(0.75f,-0.175f,0.0f); glVertex3f(0.875f,-0.175f,0.0f); glVertex3f(0.875f,-0.075f,0.0f); glVertex3f(-0.075f,0.075f,0.0f); // MIDDLE DOT glVertex3f(0.075f,0.075f,0.0f); glVertex3f(0.075f,-0.075f,0.0f); glVertex3f(-0.075f,-0.075f,0.0f); glColor3f(1.0f, 1.0f, 1.0f); glEnd(); // OUTLINES IN WHITE glBegin(GL_LINE_LOOP); glColor3f(1.0f,1.0f,1.0f); glVertex3f(-1.75f,0.075f,0.0f); //LEFT glVertex3f(-0.75f,0.075f,0.0f); glVertex3f(-0.75f,-0.175f,0.0f); glVertex3f(-0.875f,-0.175f,0.0f); glVertex3f(-0.875f,-0.075f,0.0f); glVertex3f(-1.75f,-0.075f,0.0f); glEnd(); glBegin(GL_LINE_LOOP); glColor3f(1.0f,1.0f,1.0f); glVertex3f(1.75f,0.075f,0.0f); //LEFT glVertex3f(0.75f,0.075f,0.0f); glVertex3f(0.75f,-0.175f,0.0f); glVertex3f(0.875f,-0.175f,0.0f); glVertex3f(0.875f,-0.075f,0.0f); glVertex3f(1.75f,-0.075f,0.0f); glEnd(); glBegin(GL_LINE_LOOP); glVertex3f(-0.075f,0.075f,0.0f); // MIDDLE DOT glVertex3f(0.075f,0.075f,0.0f); glVertex3f(0.075f,-0.075f,0.0f); glVertex3f(-0.075f,-0.075f,0.0f); glColor3f(1.0f, 1.0f, 1.0f); glEnd(); // glPopMatrix(); // 1 pop // MOVING NON FILLED BANK TRIANGLE // glPushMatrix(); // 2 push glRotatef(fOrientationData[0],0.0f,0.0f,1.0f); glBegin(GL_LINE_LOOP); glVertex3f(-0.15f,1.6f,0.0f); glVertex3f(-0.15f,1.5f,0.0f); glVertex3f(0.15f,1.5f,0.0f); glVertex3f(0.15f,1.6f,0.0f); glVertex3f(0.0f,1.8,0.0f); glColor3f(1.0f, 1.0f, 1.0f); glEnd(); // glPopMatrix(); // 2 pop glBegin(GL_TRIANGLES); // NON MOVING BANK TRIANGLE - R=1.8 glVertex3f(0.0f,1.8,0.0f); glVertex3f(-0.15f,2.0f,0.0f); glVertex3f(0.15f,2.0f,0.0f); glEnd(); glRotatef(90,0.0f,0.0f,1.0f); glBegin(GL_LINES); glVertex3f(radius_1*cos(pi/18),radius_1*sin(pi/18),0.0f); //10 deg glVertex3f(radius_2*cos(pi/18),radius_2*sin(pi/18),0.0f); glVertex3f(radius_1*cos(pi/9),radius_1*sin(pi/9),0.0f); // 20 deg glVertex3f(radius_2*cos(pi/9),radius_2*sin(pi/9),0.0f); glVertex3f(radius_1*cos(pi/6),radius_1*sin(pi/6),0.0f); // 30 deg glVertex3f(radius_3*cos(pi/6),radius_3*sin(pi/6),0.0f); glVertex3f(radius_1*cos(pi/4),radius_1*sin(pi/4),0.0f); // 45 deg glVertex3f(radius_2*cos(pi/4),radius_2*sin(pi/4),0.0f); glVertex3f(radius_1*cos(pi/3),radius_1*sin(pi/3),0.0f); // 60 deg glVertex3f(radius_3*cos(pi/3),radius_3*sin(pi/3),0.0f); glEnd(); pi=pi*-1; glBegin(GL_LINES); glVertex3f(radius_1*cos(pi/18),radius_1*sin(pi/18),0.0f); //10 deg glVertex3f(radius_2*cos(pi/18),radius_2*sin(pi/18),0.0f); glVertex3f(radius_1*cos(pi/9),radius_1*sin(pi/9),0.0f); // 20 deg glVertex3f(radius_2*cos(pi/9),radius_2*sin(pi/9),0.0f); glVertex3f(radius_1*cos(pi/6),radius_1*sin(pi/6),0.0f); // 30 deg glVertex3f(radius_3*cos(pi/6),radius_3*sin(pi/6),0.0f); glVertex3f(radius_1*cos(pi/4),radius_1*sin(pi/4),0.0f); // 45 deg glVertex3f(radius_2*cos(pi/4),radius_2*sin(pi/4),0.0f); glVertex3f(radius_1*cos(pi/3),radius_1*sin(pi/3),0.0f); // 60 deg glVertex3f(radius_3*cos(pi/3),radius_3*sin(pi/3),0.0f); glEnd(); //**** Enable texturing glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); glDisable(GL_DEPTH_TEST); glBlendFunc(GL_DST_COLOR,GL_ZERO); glBindTexture(GL_TEXTURE_2D, texture[1]); glBegin(GL_QUADS); // Start Drawing A Textured Quad glTexCoord2f(0.0f, 1.0f); glVertex3f(-5.0f, 5.0f, 0.0f); // Bottom Left glTexCoord2f(1.0f, 1.0f); glVertex3f(5.0f, 5.0f, 0.0f); // Bottom Right glTexCoord2f(1.0f, 0.0f); glVertex3f(5.0f, -5.0f, 0.0f); // Top Right glTexCoord2f(0.0f, 0.0f); glVertex3f(-5.0f, -5.0f, 0.0f); // Top Left glEnd(); glDisable(GL_BLEND); */ As you can see above I have remarked out a heap of stuff and it seems to be running ok without crashing. I really think its some sort of stack error. I cant even see where the code is breaking because it says no source code available for the current location. As soon as I unremark any of the remarked code, the error happens again. Anyone please help. Thanks -Al PS: Full code at http://www.hstuart.dk/paste/view.aspx?id=feddb667-fc12-4b6a-917d-68698f8ffa30
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!