Jump to content
  • Advertisement

kayX

Member
  • Content Count

    101
  • Joined

  • Last visited

Community Reputation

152 Neutral

About kayX

  • Rank
    Member
  1. I am assuming that you would use a back buffer to do all your drawing before showing it to the user. You could have a System.Drawing.Bitmap object as your back buffer. You could draw stuff on it using the Graphics object or if you wanted pixel access, you could lock your Bitmap object and access the data through the returned pointer. *EDITED* - Added some codes just incase you need it. System.Drawing.Bitmap backBuffer = new Bitmap(myWin.Width, myWin.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb); //Lock bitmap object. System.Drawing.Imaging.BitmapData bmpData = backBuffer.LockBits(new System.Drawing.Rectangle(0, 0, backBuffer.Width, backBuffer.Height); //Get pointer to pixel data and do some stuff to it. byte* pPixelData = bmpData.Scan0.ToPointer(); //Remember to unlock it. backBuffer.UnlockBits(bmpData);
  2. kayX

    Lost device

    HHmm... openGl sound cool then. Thanks.
  3. Hi everyone, Does openGl has a lost device state like directX do? I can't seems to find such thing and if it doesn't, why? I've been using directX all these while and i am asking out of curiousity. Thanks
  4. Hi everyone. I've created a Texture in the managed pool and lock it to draw some stuff on it. When a Lost Device occurs, I lost all my modification. How do I prevent this lost of data? Thanks in advance
  5. kayX

    Texturing problem...

    Try changing to glTexCoord2f(0, 0); glVertex2f(0, 0); glTexCoord2f(0, height ); glVertex2f(0, 1); glTexCoord2f(width, height); glVertex2f(1, 1); glTexCoord2f(width, 0); glVertex2f(1, 0);
  6. Hi, I would like to create a user control (as with c#) using cpp but i have no idea how. For example, I would like to create a text box that i could put imaged inside and stuff. Any help or reference to resources would be great. Thanks in advance.
  7. Thanks for the speedy reply. But its sad news indeed. Hahaha.
  8. Hi all, normally a vertex shader will work with input from the vertex buffer. I am wondering whether it is possible to process the data again with another vertex shader on the result of the previous vertex shader. In other words, vertex shader 2 in dependent on the result of vertex shader 1. Any idea? Thanks in advance.
  9. kayX

    B-Spline calculation

    Thanks again for your help! :)
  10. kayX

    B-Spline calculation

    Aha!!! I finally realize where the problem lies! This is how i used to do it for(float t = 0f; t <= 1f; t+=stepSize) My problem is due to the parameter range from 0 to 1 In the document that you linked, for a uniform knot of [0,1,2,3,4,5,6,7], the parameter range is [2,5]. This shows me that parameter range should be taken according to the knot values. since the example given is a quadratic, with some figuring, i realize that i should take from knot[degree] = 2; knot[knotlength-degree-1] = 5 I plug it in my program and now it gives result that match other applets that i came across. Anything that i get wrongly still? Hope my result is not of coincident.
  11. kayX

    B-Spline calculation

    How about nonperiodic B-spline? What i've read so far says p = order of the curve, First p knot value = 0, Last p knot value = 1 This is what giving me the division by zero problem. Any thoughts on this? This whole spline thingy is quite confusing sometimes. Looking forward for further replies.
  12. kayX

    B-Spline calculation

    Hi! I'm back with some questions to ask. If i have knot vectors that have same values, then i will still get a division by 0 error. As far as i know, it is legal to have knot vector of same value as long as it is non decreasing
  13. kayX

    B-Spline calculation

    Thanks. I'll take a read first
  14. kayX

    B-Spline calculation

    Hi! I am currently trying to write a b spline drawing program and i would like to confirm with others whether what i have is correct for i am not getting the right results. //Here is how i do it. //interpolate the t parameter (0f to 1f) for(float t = 0f; t <= 1f; t+=fStepSize) { //Sum for x and y fX = 0f; fY = 0f; //Loop through all points for(int i = Points.Count-1; i >= 0; i--) { fBasisValue = BSplineBasis(t, i, intDegree); //Get value from basis function fX += fBasisValue*arrPoints.X; fY += fBasisValue*arrPoints.Y; } AddPoint(fX, fY); } BSplineBasis is a recursive function public float BSplineBasis(float t, int i, int p) { if(p == 0f) { if(knot <= t && knot[i+1] > t) return 1f; return 0f; } return (t-knot)/(knot[i+p]-knot) * BSplineBasis(t,i,p-1) + (knot[i+p+1]-t)/(knot[i+p+1]-knot[i+1])*BSplineBasis(t,i+1,p-1); } There problem i encounter is when knot[i+p] - knot = 0. I will get a NaN because of division by 0. How should i handle the division by 0 thingy? Cause the mathematical formula i see does not say anything bout it. http://mathworld.wolfram.com/B-Spline.html Or is there anything else cause problem? Thanks in advance
  15. kayX

    Texture pitch

    Hhmm... Then i think i'll better not over writes them. Thanks for your reply
  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!