ERLEDIGT
NEIN
NEIN
ANTWORTEN
1
1
ZUGRIFFE
1702
1702
EMPFEHLEN
-
ich versuche gerade einen vertexbuffer zu implementieren, habe jedoch nicht viel erfolg. ich erhalte nur ein scharzes bild, es sollte aber ein gelbes dreieck zu sehen sein. mittlerweile bin ich unzählige tutorials durchgegangen (meist c/c++) und ich finde den fehler nicht...
hab schon viel rumprobiert und auch mit einem IntPtr statt float[] (für den Buffernamen) versucht. wo liegt der fehler?
system: windows
sprache: c# (.net 2.0)
api: opengl 2.0 (tao framework: open gl binding 2.1.0.4 + win platform api binding 1.0.0.4)
Code :1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
class RenderGL { Form window = new Form(); SimpleOpenGlControl control = new SimpleOpenGlControl(); private float[] id = new float[1]; float[] buffer = {3.0f, 3.0f, 0.0f, 9.0f, 3.0f, 0.0f, 3.0f, 9.0f, 0.0f}; public RenderGL(string windowTitle) { title = windowTitle; window.ClientSize = new System.Drawing.Size(512, 512); window.Text = "RenderGL"; window.Controls.Add(control); control.Dock = DockStyle.Fill; control.InitializeContexts(); Gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); Gl.glEnable(Gl.GL_DEPTH_TEST); Gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); Gl.glMatrixMode(Gl.GL_PROJECTION); Gl.glLoadIdentity(); Gl.glOrtho(0.0, 10.0, 0.0, 10.0, -1.0, 1.0); Gl.glGenBuffersARB(1, id); Gl.glBindBufferARB(Gl.GL_ARRAY_BUFFER, id[0]); Gl.glBufferDataARB( Gl.GL_ARRAY_BUFFER_ARB, (IntPtr)(buffer.Length * sizeof(float)), buffer, Gl.GL_STATIC_DRAW_ARB); window.Show(); } // wird in der Hauptschleife aufgerufen public void Render() { Gl.glClear(Gl.GL_COLOR_BUFFER_BIT | Gl.GL_DEPTH_BUFFER_BIT); Gl.glBindBufferARB(Gl.GL_ARRAY_BUFFER, id[0]); Gl.glVertexPointer(3, Gl.GL_FLOAT, 0, 0); Gl.glColor3f(1.0f, 1.0f, 0.0f); Gl.glEnableClientState(Gl.GL_VERTEX_ARRAY); Gl.glDrawArrays(Gl.GL_TRIANGLES, 0, buffer.Length / 3); Gl.glDisableClientState(Gl.GL_VERTEX_ARRAY); control.Draw(); } }
-
23.10.07 23:46 #2
Hallo, schau mal im Post 3 hat jemand ein funktionierendes Beispiel gepostet, das fast wie deins aussieht

http://www.zfx.info/DisplayThread.php?TID=24033Internetseite:
http://www.texturenland.de
Blog:
http://blog.texturenland.de
Codesnippets:
.NET-Snippets
- Sollte ich bei einer Frage weitergeholfen haben, würde ich mich über eine positive Bewertung freuen -
Ähnliche Themen
-
Vertex selection problem
Von mOnis im Forum Autodesk Maya (ehemals Alias)Antworten: 3Letzter Beitrag: 05.06.10, 10:11 -
openGL - vertex-shader
Von Cromon im Forum C/C++Antworten: 3Letzter Beitrag: 30.09.09, 15:02 -
[C++] Zwei serielle Schnittstellen - Problem mit Datenueberlagerung/Buffer?!!
Von Lorbeer im Forum C/C++Antworten: 0Letzter Beitrag: 26.06.07, 21:18 -
[OpenGl] Buffer-Befehl? ("Zucken/Ruckeln")
Von baum77 im Forum C/C++Antworten: 8Letzter Beitrag: 13.05.05, 22:39 -
Problem mit Bones und Vertex Maps
Von dastool im Forum Cinema 4DAntworten: 4Letzter Beitrag: 02.12.04, 17:36





Zitieren
Login





