Stilllegung des Forums
Das Forum wurde am 05.06.2023 nach über 20 Jahren stillgelegt (weitere Informationen und ein kleiner Rückblick).
Registrierungen, Anmeldungen und Postings sind nicht mehr möglich. Öffentliche Inhalte sind weiterhin zugänglich.
Das Team von spieleprogrammierer.de bedankt sich bei der Community für die vielen schönen Jahre.
Wenn du eine deutschsprachige Spieleentwickler-Community suchst, schau doch mal im Discord und auf ZFX vorbei!
Werbeanzeige
Community-Fossil
Beruf: Teamleiter Mobile Applikationen & Senior Software Engineer
Quellcode |
|
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 |
this.bind_anyway(); /* glBegin(GL_QUADS); // top left glTexCoord2f(0.25, 0.25); glVertex2f(0, 0); // top right glTexCoord2f(0.8, 0.25); glVertex2f(w, 0); // bottom right glTexCoord2f(0.8, 0.8); glVertex2f(w, h); // bottom left glTexCoord2f(0.25, 0.8); glVertex2f(0, h); glEnd(); */ glBegin(GL_QUADS); // top left glTexCoord2f(0.25, 0.25); glVertex2f(0, 0); // top right glTexCoord2f(0.8, 0.25); glVertex2f(400, 0); // bottom right glTexCoord2f(0.8, 0.8); glVertex2f(400, 400); // bottom left glTexCoord2f(0.25, 0.8); glVertex2f(0, 400); glEnd(); |
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »Architekt« (19.01.2012, 19:33)
Community-Fossil
Beruf: Teamleiter Mobile Applikationen & Senior Software Engineer
Community-Fossil
Beruf: Teamleiter Mobile Applikationen & Senior Software Engineer
C#-Quelltext |
|
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 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
Texture subimage() { assert(this._pixels !is null); const ushort w = 52; const ushort h = 52; const ushort fromx = 31; const ushort fromy = 38; GLuint Screen; glGenTextures(1, &Screen); //writefln("gen. Id for Sub.: %d", Screen); glBindTexture(GL_TEXTURE_2D, Screen); // Daten in den Speicher, Lineares Filtering aktivieren glTexImage2D(GL_TEXTURE_2D, 0, 4, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, null); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); //GC.free(memory); glClearColor(0.0, 0.0, 0.0,0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glBindTexture(GL_TEXTURE_2D, Screen); this.bind_anyway(); const ushort vp_w = Texture._window_width; const ushort vp_h = Texture._window_height; const float percent_x = cast(float)(vp_w) / this._width; const float percent_y = cast(float)(vp_h) / this._height; //glViewport(0, 0, vp_w, vp_h); glBegin(GL_QUADS); // top left glTexCoord2f(0, 0); glVertex2f(0, 0); // top right glTexCoord2f(1, 0); glVertex2f(vp_w, 0); // bottom right glTexCoord2f(1, 1); glVertex2f(vp_w, vp_h); // bottom left glTexCoord2f(0, 1); glVertex2f(0, vp_h); glEnd(); //glViewport(0, 0, 400, 400); glBindTexture(GL_TEXTURE_2D, Screen); glCopyTexImage2D(GL_TEXTURE_2D, 0, this._format, cast(uint)(fromx * percent_x), cast(uint)(fromy * percent_y), w, h, 0); // Löschen des Color-Buffers. Deaktiviert sieht man eine weitere Textur unten. glClearColor(1.0, 1.0, 1.0, 0.0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Zeichnen der Kopie glBindTexture(GL_TEXTURE_2D, Screen); const ubyte d = 5; glBegin(GL_QUADS); // top left glTexCoord2i(0, 0); glVertex2f(d, d); // top right glTexCoord2i(1, 0); glVertex2f(w + d, d); // bottom right glTexCoord2i(1, 1); glVertex2f(w + d, h + d); // bottom left glTexCoord2i(0, 1); glVertex2f(d, h + d); glEnd(); glDeleteTextures(1, &Screen); //return new Texture(Rect(fromx, fromy, w, h), Screen, this); return null; } |
Community-Fossil
Beruf: Teamleiter Mobile Applikationen & Senior Software Engineer
Werbeanzeige