Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

c# - How can I rotate triangle (clock-wise ) with CSGL? -


i'm trying make clock-wise rotating triangle, can not. made timer control result same without timer. result, below code not show rotating triangle. how can rotate triangle csgl?

namespace windrawcoordinate {     public partial class form1 : form     {         public form1()         {             initializecomponent();         }          private float = 0.0f;         private void form1_load(object sender, eventargs e)         {              timer1.start();         }          protected void gosterim()         {             gl.glclear(gl.gl_color_buffer_bit);             gl.glloadidentity();             hesapla();             ucgen();          }         protected void ayarlar()         {             gl.glclearcolor(1, 1, 1, 1);             gl.glshademodel(gl.gl_flat);         }         protected void hesapla()         {             += 0.5f;             this.refresh();         }          protected void ucgen()         {             gl.glcolor3f(0, 1, 1);             gl.glrotatef(a, 0, 0, -1);             gl.glbegin(gl.gl_triangles);             gl.glvertex2f(-0.2f, -0.2f);             gl.glvertex2f(0.2f, -0.2f);             gl.glvertex2f(0.0f, 0.2f);             gl.glend();         }          private void timer1_tick(object sender, eventargs e)         {             ayarlar();              gosterim();         }     }

from code posted see couple things:

  1. you don't have matrix set-up. while can use default matrices should specify own ensure triangle expect. default matrices should work here specify identity modelview , projection.

  2. you don't have call swap buffers. need call after you're done drawing swap front , buffers triangle displayed. csgl think there swapbuffer() method can use.

  3. don't use timer pump redrawing. timers work unreliably use windows message pump , hard results from. instead should use render loop--a loop runs entire time program runs , keeps refreshing screen. have make sure give operating system time handle messages though. simple render loop might be:

    void renderloop() {   while (true) {     setupcamera();     creategeometry();     swapbuffers();     application.doevents(); // lets windows process messages   } } 

    note there better ways message loop in c# easy set , reason about.


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -