Jump to content
  • Advertisement

Kwak

Member
  • Content Count

    105
  • Joined

  • Last visited

Community Reputation

220 Neutral

About Kwak

  • Rank
    Member
  1. Ok, this is the exception i'm getting: (message=dutch for "Error while coupling the windows") I tried the panel already, but i get very strange results. For some panel sizes, the opengl rendering does not happen. And if the rendering does work, it seems that not the whole panel can be used for drawing. A stip of 20 pixels wide, at the top of the panel is not used, and initially you can see through it (windows behind/desktop). I also tried the SimpleOpenGLControl (Tao Framework), on a frame and in a panel, with the same errors. When i create the form myself, OpenGL rendering works fine. Thats why i thought i could make an MDI Child window for opengl rendering, since rendering to a self made form works fine. I have to admit that i'm trying to walk around the problems, but i ve spent way too much time for something very simple... i would be satisfied if i can solve it in a less elegant way. System.ComponentModel.Win32Exception was unhandled Message="Fout bij het maken van de vensterkoppeling." Source="System.Windows.Forms" ErrorCode=-2147467259 NativeErrorCode=0 StackTrace: bij System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp) bij System.Windows.Forms.Control.CreateHandle() bij System.Windows.Forms.Form.CreateHandle() bij System.Windows.Forms.Control.get_Handle() bij Project1.Class1.Main() in C:\Users\Klaas\Desktop\ProgramThesis\Tests\DispPrecipitation03\DispPrecipitation\Class1.cs:regel 71 bij System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) bij System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) bij Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() bij System.Threading.ThreadHelper.ThreadStart_Context(Object state) bij System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) bij System.Threading.ThreadHelper.ThreadStart() InnerException:
  2. I'm trying to obtain the handle of a childwindow, so that a device and rendering context can be created for OpenGL. Whenever i try to access the handle of the child window, an error occurs due to an unhandled exception. When i do not include the last line of code (below), the error does not occur, and the window and child window are displayed correctly. Drawing in OpenGL is impossible however. Has anybody an idea how i can obtain the handle? MainForm = new Form(); MainForm.Parent = null; MainForm.TopLevel = true; // MDI container forms must be on top level MainForm.IsMdiContainer = true; //because childwindows will be added OpenGLForm = new Form(); OpenGLForm.MdiParent = MainForm; Console.WriteLine("ParentForm Handle: " + MainForm.Handle); Console.WriteLine("OpenGLForm Handle: " + OpenGLorm.Handle); // Causes error!!
  3. I implemented my gameloop like this: __fastcall TMainForm::TMainForm(TComponent* Owner) : TForm(Owner) { Application->OnIdle = IdleLoop; _control87(MCW_EM, MCW_EM); // turn off floating point exceptions } //--------------------------------------------------------------------------- void __fastcall TMainForm::IdleLoop(TObject*, bool& done) { drawGame(); SwapBuffers(hdc); } The result was not exactly what i wanted. The screen is only refreshed when the computer is idle, which takes sometimes more than 5 seconds. Impossible to do some animation that way. I did not find any other solution than writing a whole Window-class with its own handleMessages() routine. Any ideas how to solve this in a less drastic way? (I am using the vcl library)
  4. awesome These tutorials look really easy to understand I look forward to the "using OpenGl with SDL" tutorial
  5. Kwak

    Line-triangle collisions?

    Glad to hear it helped.
  6. Kwak

    Line-triangle collisions?

    Quote: Thanks for that link Kwak; It seems like it'll work great, but I have a question about it. What would VECTOR3::subs() be? Simple vector subtraction (always thought it was named subStraction so i named it subs, should be sub then) subs(v1, v2) = v1-v2 EDIT: I have changed the post in the link and added the sub code ;)
  7. Kwak

    Lighting position problem

    A normal defines what direction is perpendicular to the face. If a light shines perpendicular on a face, the reflection is higher. So the intensity of the reflection can be calculated by dotProduct(faceNormal, lightDirection). Why doesn't opengl calculate the normals? if you have a sphere and you calculate the normals perpendicular to the faces you get this: if you calculate the normals not perpendicular to the faces, but perpendicular to a perfect sphere you get this: (In this case different points of the same face have different normals, but coincident points have the same normals) Note that this is only how diffuse light works.
  8. Kwak

    Lighting position problem

    DeathCrush is right about the gl.glLightfv(GL.GL_LIGHT1, GL.GL_POSITION,this.lightPosition) function. glTranslate, glRotate and glScale affect the position. So in your case the light rotates with it. But you did not see any light at all... Think you forgot all about normals. OpenGL calculates the intensity of the light on each object, and herefore it uses the normals of the polygons. I guess normals are (0, 0, 0) by default, so there is no lighting. Try adding normals. (with length 1.0f) Hope this helps...
  9. Kwak

    Line-triangle collisions?

    I posted this one several times, so tell me if i'm getting irritant: Line- Triangle Collision Code
  10. Kwak

    Lighting question

    Not sure but i think it should be like this drawScene() { gluLookAt(cameraPos, LookatPos, UpDirection); specify light position drawing stuff } what i mean is you should not specify light position before lookat
  11. Kwak

    Ray Triangle intersection

    You are totally right about that The code in the topic is right though: "kPar>=0 && lPar>=0 && kPar+lPar<=1"
  12. Kwak

    Ray Triangle intersection

    maybe you could use this code i wrote once: Topic
  13. Kwak

    Ray Triangle intersection

    P0,P1,P2 are the 3 verts for the tri P is the point of intersection R0, R1 are the 2 points of the ray => write P as P0 + k*(P1-P0) + l*(P2-P0) (where k and l are floats) => (1) if k+l<=1 then is P a point within the triangle => (2) test if R0 is on one side of the plane defined by P0,P1,P2 and R1 is on the other side. if this is the case, P is a point of the line R0R1 dotProduct((R0 - P),N)*dotProduct((R1 - P),N)<=0 (positive*negative) = negative => if (1) and (2) are true then there is a line-triangle collision
  14. thx tachikoma I tried this: __asm { movzx eax, BYTE PTR [move] // eax = content of move mov ebx, offset _fPlaceFallthrough //eax = _fPlaceFallthrough cmp BYTE PTR [ebx+eax*4],-3 //if _fPlaceFallthrough[move*4]!= -3) jnz validMove // goto validMove mov message, INVALID_MOVE jmp endAsm validMove: dec BYTE PTR [ebx+eax*4] // decFallthrough(move*4); dec BYTE PTR [ebx+eax*4 +1] // decFallthrough(move*4 + 1); dec BYTE PTR [ebx+eax*4 +2] // decFallthrough(move*4 + 2); dec BYTE PTR [ebx+eax*4 +3] // decFallthrough(move*4 + 3); endAsm: } but as soon as the program starts, i get a stack overflow error. Quote:by Lessbread Although the argument to the function is a char, it gets pushed as a dword in order to maintain stack alignment. Also note that on 32 bit systems, 32 bit registers are faster. should i do pop eax first? pop move from the stack movzx eax, BYTE PTR [move] [] means get the value at address... so shouldn't it be movzx eax, BYTE PTR [&move] cmp BYTE PTR [ebx+eax*4],-3 I'm stunned this is possible. I thought ebx+eax*4 should be calculated with add and mult commands first. to promit: never thought of inline (never used it too), I'll certainly get rid of those defines. Like you say, i'd better not mess around with assembler in my code, but i'd like to test the inline asm commands.
  15. I've checked my code. I've used mov instead of moves. moves generates an error: invalid combination of opcode and operands. I thougt i could use it to convert signed 1 byte integers (chars) to two byte integers (shorts)
  • 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!