2 * psychlops_devices_nidaqmxbase.cpp
\r
3 * Psychlops Standard Library (Universal)
\r
5 * Last Modified 2009/04/14 by Kenchi HOSOKAWA
\r
6 * (C) 2009 Kenchi HOSOKAWA, Kazushi MARUYA, Takao SATO
\r
9 #include "../../core/ApplicationInterfaces/psychlops_code_exception.h"
\r
10 #include "../../core/devices/psychlops_io_hid.h"
\r
11 #include "../../core/graphic/psychlops_g_canvas.h"
\r
12 #include "../../core/math/psychlops_math.h"
\r
13 #include "../../platform/gl/extension/psychlops_g_shader_gl.h"
\r
15 #include "psychlops_devices_crs_bits.h"
\r
17 #if defined(__APPLE__)
\r
19 //#include "C:\Program Files\Cambridge Research Systems\VSGV7\Windows\WIN32\MSC\include\bits++.h"
\r
24 namespace Psychlops {
\r
28 const unsigned char BitsTlock::COMMAND_R[8] = { 69 ,40 ,19 ,119,52 ,233,41 ,183 };
\r
29 const unsigned char BitsTlock::COMMAND_G[8] = { 33 ,230,190,84 ,12 ,108,201,124 };
\r
30 const unsigned char BitsTlock::COMMAND_B[8] = { 56 ,208,102,207,192,172,80 ,221 };
\r
32 const unsigned char BitsTlock::PALLETE_R[8] = { 36 ,63 , 8 ,211,3 ,112,56 ,34 };
\r
33 const unsigned char BitsTlock::PALLETE_G[8] = {106 ,136,19 ,25 ,115,68, 41, 156};
\r
34 const unsigned char BitsTlock::PALLETE_B[8] = {133 ,163,138,46 ,164,9 ,49, 208};
\r
36 inline double CTB(int param)
\r
38 return param / 255.0;
\r
41 void BitsPallete::initialize()
\r
45 Color::setGammaValue(1.0,1.0,1.0);
\r
46 tlock.set(20,1,Image::RGB);
\r
47 for(int i=0; i<8; i++) {
\r
48 tlock.pix(i, 0, Color(CTB(BitsTlock::COMMAND_R[i]), CTB(BitsTlock::COMMAND_G[i]), CTB(BitsTlock::COMMAND_B[i])) );
\r
50 Color::setGammaValue(1.0,1.0,1.0, Color::BITS_MONO);
\r
54 BitsPallete::BitsPallete()
\r
56 is_initialized = false;
\r
60 void BitsPallete::set(double *val)
\r
62 Color::setGammaValue(1.0,1.0,1.0);
\r
63 int packet_length = 1;
\r
64 tlock.pix(8, 0, Color(CTB(0), CTB(0), CTB(packet_length-1)));
\r
65 tlock.pix(9, 0, Color(CTB(6), CTB(0), CTB(2)));
\r
66 tlock.pix(10, 0, Color(CTB(0), CTB(0), CTB(0)));
\r
67 tlock.pix(11, 0, Color(CTB(7), CTB(255), CTB(255)));
\r
69 tlock.pix(12, 0, Color(CTB(0), CTB(0), CTB(0)));
\r
70 //tlock.pix(14, 0, Color(CTB(0), CTB(0), CTB(0));
\r
71 //tlock.pix(16, 0, Color(CTB(0), CTB(0), CTB(0));
\r
72 //tlock.pix(18, 0, Color(CTB(0), CTB(0), CTB(0));
\r
75 tlock.pix(13, 0, Color(CTB(7), w >> 8 / 255, w >> 255 ));
\r
76 Color::setGammaValue(1.0,1.0,1.0, Color::BITS_MONO);
\r
80 void BitsTrigger::initialize()
\r
84 Color::setGammaValue(1.0,1.0,1.0);
\r
85 tlock.set(20,1,Image::RGB);
\r
86 for(int i=0; i<8; i++) {
\r
87 tlock.pix(i, 0, Color(CTB(BitsTlock::COMMAND_R[i]), CTB(BitsTlock::COMMAND_G[i]), CTB(BitsTlock::COMMAND_B[i])) );
\r
89 Color::setGammaValue(1.0,1.0,1.0, Color::BITS_MONO);
\r
93 BitsTrigger::BitsTrigger()
\r
95 is_initialized = false;
\r
99 void BitsTrigger::set(double val)
\r
101 Color::setGammaValue(1.0,1.0,1.0);
\r
102 int packet_length = 1;
\r
103 tlock.pix(8, 0, Color(CTB(0), CTB(0), CTB(packet_length-1)));
\r
104 tlock.pix(9, 0, Color(CTB(6), CTB(0), CTB(2)));
\r
105 tlock.pix(10, 0, Color(CTB(0), CTB(0), CTB(0)));
\r
106 tlock.pix(11, 0, Color(CTB(7), CTB(255), CTB(255)));
\r
108 tlock.pix(12, 0, Color(CTB(0), CTB(0), CTB(0)));
\r
109 //tlock.pix(14, 0, Color(CTB(0), CTB(0), CTB(0));
\r
110 //tlock.pix(16, 0, Color(CTB(0), CTB(0), CTB(0));
\r
111 //tlock.pix(18, 0, Color(CTB(0), CTB(0), CTB(0));
\r
114 tlock.pix(13, 0, Color(CTB(7), w >> 8 / 255, w >> 255 ));
\r
115 tlock.setDatum(Point(0, Display::getHeight()-1));
\r
116 Color::setGammaValue(1.0,1.0,1.0, Color::BITS_MONO);
\r
119 void BitsTrigger::out()
\r
128 void BitsResponseBox::initialize()
\r
130 if(!is_initialized)
\r
132 tlock.set(12,1,Image::RGB);
\r
133 for(int i=0; i<8; i++) {
\r
134 tlock.pix(i, 0, Color(CTB(BitsTlock::COMMAND_R[i]), CTB(BitsTlock::COMMAND_G[i]), CTB(BitsTlock::COMMAND_B[i])) );
\r
136 tlock.pix(8, 0, Color(CTB(0), CTB(0), CTB(1)));
\r
137 tlock.pix(9, 0, Color(CTB(6), CTB(12), CTB(0)));
\r
138 tlock.pix(10, 0, Color(CTB(0), CTB(0), CTB(0)));
\r
139 tlock.pix(11, 0, Color(CTB(0), CTB(0), CTB(0)));
\r
143 BitsResponseBox::BitsResponseBox()
\r
145 is_initialized = false;
\r
148 BitsResponseBox::BitsResponseBox(unsigned long BoxType)
\r
150 is_initialized = false;
\r
154 BitsResponseBox::~BitsResponseBox()
\r
158 void BitsResponseBox::buzzer(unsigned long Period, unsigned long Frequency)
\r
160 bitsCbboxBuzzer(Period, Frequency); /* Buzz CB1 buzzer
\r
162 void BitsResponseBox::sendback()
\r
164 bitsCbboxSendback(); /* Ask explicitly for switch settings
\r
175 void BitsResponseBox::reset()
\r
179 void BitsResponseBox::check()
\r
181 bitsCbboxCheck(&C); /* Check if any switches have changed
\r
183 void BitsResponseBox::flush()
\r
185 bitsCbboxFlush(); /* Flush the input buffer
\r
188 void BitsResponseBox::open(unsigned long BoxType)
\r
190 DWORD res = bitsCbboxOpen(BoxType);
\r
191 std::cout << res << std::endl;
\r
193 void BitsResponseBox::close()
\r
195 bitsCbboxClose(); /* Reset interrupt vectors
\r
202 //////// Construct and Destruct ////////
\r
203 class DirectGetColor {
\r
205 inline static unsigned char round8bit(double value) {
\r
206 double val = value*255.0+0.5, integer_part, frac;
\r
207 frac = modf(val, &integer_part);
\r
208 if(frac!=0.0) return (unsigned char)integer_part;
\r
209 if((int)(integer_part)%2==0) return (unsigned char)integer_part; else return (unsigned char)integer_part-1;
\r
211 static void setColor4ub(const Color &color) {
\r
212 glColor4ub(round8bit(color.getR()), round8bit(color.getG()), round8bit(color.getB()), round8bit(color.getA()));
\r
214 static void setColorClear4ub(const Color &color) {
\r
215 glClearColor((GLclampf)round8bit(color.getR())/255.0, (GLclampf)round8bit(color.getG())/255.0, (GLclampf)round8bit(color.getB())/255.0, (GLclampf)round8bit(color.getA())/255.0);
\r
217 static void setColor4Through(const Color &color) {
\r
218 glColor4d(color.getR(), color.getG(), color.getB(), color.getA());
\r
220 static void setColorClaer4Through(const Color &color) {
\r
221 glClearColor(color.getR(), color.getG(), color.getB(), color.getA());
\r
226 CanvasBits::CanvasBits(void) : Canvas() {
\r
228 CanvasBits::CanvasBits(CanvasMode mode) : Canvas(mode) {
\r
230 CanvasBits::CanvasBits(int d_width, int d_height, int d_colordepth, double d_refreshrate, CanvasMode mode)
\r
231 : Canvas(d_width, d_height, d_colordepth, d_refreshrate) {
\r
233 CanvasBits::~CanvasBits(void) {
\r
238 void CanvasBits::popMatrixes() {
\r
239 glMatrixMode(GL_MODELVIEW);
\r
241 glMatrixMode(GL_PROJECTION);
\r
244 void CanvasBits::loadOrthoProjection() {
\r
245 glMatrixMode(GL_PROJECTION);
\r
247 glOrtho(-0.375, Width-0.375, Height-0.375, -0.375, -1000, 1000);
\r
248 glMatrixMode(GL_MODELVIEW);
\r
250 // glDisable(GL_LIGHTING);
\r
251 // glDisable(GL_DEPTH_TEST);
\r
254 void CanvasBits::initAPIprop() {
\r
255 switch(colordepth) {
\r
258 APIsetColor = &(DirectGetColor::setColor4Through);
\r
259 APIsetColorClear = &(DirectGetColor::setColorClaer4Through);
\r
262 APIsetColor = &(DirectGetColor::setColor4Through);
\r
263 APIsetColorClear = &(DirectGetColor::setColorClaer4Through);
\r
267 glDrawBuffer(GL_BACK);
\r
268 glReadBuffer(GL_BACK);
\r
269 //glMatrixMode(GL_PROJECTION);
\r
270 //glLoadIdentity();
\r
271 // glOrtho(0, Width, Height, 0, -1, 1);
\r
272 //glOrtho(-0.375, Width-0.375, Height-0.375, 0-0.375, -1, 1);
\r
273 //glMatrixMode(GL_MODELVIEW);
\r
274 //glLoadIdentity();
\r
275 // glTranslated(0.375, 0.375, 0.0);
\r
278 pushPixToPixProjection();
\r
279 initAPIattributes();
\r
281 glEnableClientState(GL_VERTEX_ARRAY);
\r
282 //std::string source = ShaderAPI::shader_core_pix;
\r
283 std::string source = ShaderAPI::shader_core_pix_bitscolor;
\r
284 source += "void main(void){ pix( gl_Color.r, gl_Color.g, gl_Color.b, gl_Color.a ); }";
\r
285 std::string sourcev = "";
\r
288 "uniform mat4 projectionMatrix;\r\n"
\r
289 "uniform mat4 modelviewMatrix;\r\n"
\r
290 "in vec3 position;\r\n"
\r
291 "void main(void){\r\n"
\r
292 " vec4 base_pos = projectionMatrix * modelviewMatrix * vec4(position, 1.0);\r\n"
\r
293 " base_pos.x = base_pos.x * 2.0;\r\n;"
\r
294 " gl_Position = base_pos;\r\n"
\r
296 std::vector<std::string> vars;
\r
298 //shader.cacheVertex(sourcev, *this);
\r
299 shader.cache(source, vars, *this);
\r
300 } catch(Exception *e)
\r
302 std::cout << sourcev << std::endl << std::endl;
\r
303 std::cout << e->toString();
\r
306 glUseProgram(shader.gl2Program);
\r
309 GLclampf red=0.0, green=0.0, blue=0.0, alpha=1.0;
\r
310 // default_drawing_mode_ = GL_POINTS;
\r
311 glClearColor(red,green,blue,alpha);
\r
312 clear(Color::black);
\r
314 clear(Color::black);
\r
318 void CanvasBits::initAPIattributes() {
\r
319 glPushAttrib(GL_ALL_ATTRIB_BITS);
\r
321 //// default settings ////
\r
322 glShadeModel(GL_FLAT);
\r
323 glEnable(GL_ALPHA_TEST);
\r
324 glEnable(GL_BLEND);
\r
325 glEnable(GL_LINE_STIPPLE);
\r
326 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
\r
327 glDisable(GL_POINT_SMOOTH);
\r
328 glDisable(GL_LINE_SMOOTH);
\r
329 glDisable(GL_POLYGON_SMOOTH);
\r
330 glDisable(GL_DEPTH_TEST);
\r
331 glDisable(GL_DITHER);
\r
333 glDisable(GL_LIGHTING);
\r
334 glDisable(GL_LOGIC_OP);
\r
335 glDisable(GL_STENCIL_TEST);
\r
336 glDisable(GL_TEXTURE_1D);
\r
337 glDisable(GL_TEXTURE_2D);
\r
338 glPixelTransferi(GL_MAP_COLOR, GL_FALSE);
\r
339 glPixelTransferi(GL_MAP_STENCIL, GL_FALSE);
\r
340 glPixelTransferi(GL_RED_SCALE, 1);
\r
341 glPixelTransferi(GL_RED_BIAS, 0);
\r
342 glPixelTransferi(GL_GREEN_SCALE, 1);
\r
343 glPixelTransferi(GL_GREEN_BIAS, 0);
\r
344 glPixelTransferi(GL_BLUE_SCALE, 1);
\r
345 glPixelTransferi(GL_BLUE_BIAS, 0);
\r
346 glPixelTransferi(GL_ALPHA_SCALE, 1);
\r
347 glPixelTransferi(GL_ALPHA_BIAS, 0);
\r
348 glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
\r
349 glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
\r
350 glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
\r
351 glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
\r
352 glPixelStoref(GL_UNPACK_ALIGNMENT, 4);
\r
353 glPixelStorei(GL_PACK_ALIGNMENT, 4);
\r
354 glPixelStoref(GL_PACK_ALIGNMENT, 4);
\r
355 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
\r
358 CanvasBits& CanvasBits::clear(const Color &col)
\r
360 Rectangle r(getWidth()+1, getHeight()+1);
\r
366 inline float setVertex(double x)
\r
368 return Math::round(x)*2;
\r
372 CanvasBits& CanvasBits::rect(const Rectangle &drawee, const Color &color)
\r
374 float verts[12] = {
\r
375 setVertex(drawee.getLeft()), drawee.getTop(), 0,
\r
376 setVertex(drawee.getLeft()), drawee.getBottom()+1, 0,
\r
377 setVertex(drawee.getRight()+1), drawee.getBottom()+1, 0,
\r
378 setVertex(drawee.getRight()+1), drawee.getTop(), 0
\r
380 glVertexPointer(3, GL_FLOAT, 0, verts);
\r
382 APIsetColor(color);
\r
383 // glColor4f(color.getR(), color.getG(), color.getB(), color.getA());
\r
384 glDrawArrays(GL_QUADS,0,4);
\r
388 CanvasBits& CanvasBits::rect(const Rectangle &drawee, const Stroke &strk)
\r
390 float verts[12] = {
\r
391 setVertex(drawee.getLeft()), drawee.getTop(), 0,
\r
392 setVertex(drawee.getLeft()), drawee.getBottom()+1, 0,
\r
393 setVertex(drawee.getRight()+1), drawee.getBottom()+1, 0,
\r
394 setVertex(drawee.getRight()+1), drawee.getTop(), 0
\r
396 glVertexPointer(3, GL_FLOAT, 0, verts);
\r
398 APIsetColor(strk.color);
\r
399 glDrawArrays(GL_LINE_LOOP,0,4);
\r
404 CanvasBits& CanvasBits::image(const Image &img) {
\r
405 drawImage(img, img.targetarea_.getLeft(), img.targetarea_.getTop());
\r
408 CanvasBits& CanvasBits::image(const Image &img, const double left, const double top) {
\r
409 drawImage(img, left, top);
\r
413 void CanvasBits::drawImage(const Image &img, const double left, const double top) {
\r
414 //int left = Math::round(left__);
\r
415 //int top = Math::round(top__);
\r
416 if(img.caches.count(this)==0) {
\r
417 //img.cache(*this);
\r
420 if(img.caches.count(this)!=0) {
\r
421 APIImageCache *api_ = img.caches[this].id;
\r
422 double tex_top = 1.0;
\r
423 double tex_bottom = ((double)api_->tex_height-img.height_)/api_->tex_height;
\r
426 glColor4f(1.0,1.0,1.0,1.0);
\r
427 glEnable(GL_TEXTURE_2D);
\r
428 glBindTexture(GL_TEXTURE_2D, api_->getTexIndex());
\r
431 glTexCoord2d(0, tex_top);
\r
432 glVertex2f(left, top);
\r
433 glTexCoord2d((double)img.width_/api_->tex_width , tex_top);
\r
434 glVertex2f(left+img.targetarea_.getWidth(), top);
\r
435 glTexCoord2d((double)img.width_/api_->tex_width , tex_bottom);
\r
436 glVertex2f(left+img.targetarea_.getWidth(), top+img.targetarea_.getHeight());
\r
437 glTexCoord2d(0 , tex_bottom);
\r
438 glVertex2f(left, top+img.targetarea_.getHeight());
\r
441 glDisable(GL_TEXTURE_2D);
\r
442 glUseProgram(shader.gl2Program);
\r
444 glRasterPos2d(left,img.height_+top);
\r
445 if( img.pixcomp_==Image::RGBA ) {
\r
446 glPushAttrib(GL_ALL_ATTRIB_BITS);
\r
447 glEnable(GL_BLEND);
\r
448 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
\r
449 glDrawPixels((GLsizei)img.getWidth(), (GLsizei)img.getHeight(), APIImageProperties::PixCompGL_[img.pixcomp_], APIImageProperties::PixPrecGL_[img.pixprec_], img.getBitmapPtr());
\r
450 glDisable(GL_BLEND);
\r
453 glDrawPixels((GLsizei)img.getWidth(), (GLsizei)img.getHeight(), APIImageProperties::PixCompGL_[img.pixcomp_], APIImageProperties::PixPrecGL_[img.pixprec_], img.getBitmapPtr());
\r
458 void CanvasBits::drawImage(Image &img, const Rectangle &target_area)
\r
460 if(img.caches.count(this)==0) {
\r
463 APIImageCache *api_ = img.caches[this].id;
\r
464 double tex_top = 1.0;
\r
465 double tex_bottom = ((double)api_->tex_height-img.height_)/api_->tex_height;
\r
467 glColor4f(1.0,1.0,1.0,1.0);
\r
468 glEnable(GL_TEXTURE_2D);
\r
469 glBindTexture(GL_TEXTURE_2D, api_->getTexIndex());
\r
471 glTexCoord2d(0, tex_top);
\r
472 glVertex2f(target_area.left, target_area.top);
\r
473 glTexCoord2d((double)img.width_/api_->tex_width , tex_top);
\r
474 glVertex2f(target_area.right, target_area.top);
\r
475 glTexCoord2d((double)img.width_/api_->tex_width , tex_bottom);
\r
476 glVertex2f(target_area.right, target_area.bottom);
\r
477 glTexCoord2d(0 , tex_bottom);
\r
478 glVertex2f(target_area.left, target_area.bottom);
\r
481 glDisable(GL_TEXTURE_2D);
\r
484 CanvasBits& CanvasBits::image(Image &img, const Rectangle &target_area, const Rectangle &source_rect)
\r
486 if(img.caches.count(this)==0) {
\r
489 APIImageCache *api_ = img.caches[this].id;
\r
490 // double right = left + source_rect.getWidth();
\r
491 // double bottom = top + source_rect.getHeight();
\r
492 double tex_top = 1.0;
\r
493 double tex_bottom = ((double)api_->tex_height-img.height_)/api_->tex_height;
\r
494 double tex_left = 0.0;
\r
495 double tex_right = (double)img.width_/api_->tex_width;
\r
496 double tex_height = tex_top - tex_bottom;
\r
497 double tex_width = tex_right - tex_left;
\r
498 tex_left = tex_width * source_rect.getLeft() / (img.getWidth()-1.0);
\r
499 tex_top = 1.0 - tex_height * source_rect.getTop() / (img.getHeight()-1.0);
\r
500 tex_right = tex_width * source_rect.getRight() / (img.getWidth()-1.0);
\r
501 tex_bottom = 1.0 - tex_height * source_rect.getBottom() / (img.getHeight()-1.0);
\r
502 //std::cout << "D " << tex_left << " " << tex_top << " " << tex_right << " " << tex_bottom << std::endl;
\r
504 glColor4f(1.0,1.0,1.0,1.0);
\r
505 glEnable(GL_TEXTURE_2D);
\r
506 glBindTexture(GL_TEXTURE_2D, api_->getTexIndex());
\r
509 glTexCoord2d(tex_left, tex_top);
\r
510 // glVertex2f(left, top);
\r
511 glVertex2f(target_area.left, target_area.top);
\r
513 glTexCoord2d(tex_right, tex_top);
\r
514 // glVertex2f(right, top);
\r
515 glVertex2f(target_area.right+1, target_area.top);
\r
517 glTexCoord2d(tex_right , tex_bottom);
\r
518 // glVertex2f(right, bottom);
\r
519 glVertex2f(target_area.right+1, target_area.bottom+1);
\r
521 glTexCoord2d(tex_left , tex_bottom);
\r
522 // glVertex2f(left, bottom);
\r
523 glVertex2f(target_area.left, target_area.bottom+1);
\r
527 glDisable(GL_TEXTURE_2D);
\r
532 void CanvasBits::cacheImageBody(Image &img) {
\r
533 APIImageCache *api_ = 0;
\r
534 int tex_width = 0, tex_height = 0;
\r
536 if(img.caches.count(this)==0) {
\r
539 while(pow(2.0,++i)<img.width_*2) {}
\r
540 tex_width = pow(2.0,i);
\r
542 while(pow(2.0,++i)<img.height_) {}
\r
543 tex_height = pow(2.0,i);
\r
545 api_ = img.caches[this].id;
\r
546 tex_width = api_->tex_width;
\r
547 tex_height = api_->tex_height;
\r
550 Image *tmp = new Image(tex_width, tex_height, img.pixcomp_, Image::BYTE);
\r
551 int ra, hir, lor, hig, log, hib, lob;
\r
552 double r, g, b, alpha;
\r
553 for(int y=0; y<img.height_; y++) {
\r
554 for(int x=0; x<img.width_; x++) {
\r
555 img.getPix(x,y).get(r, g, b, alpha);
\r
556 ra = (int)(r * 65535);
\r
557 hir = (ra & 0xff00) >> 8;
\r
559 ra = (int)(g * 65535);
\r
560 hig = (ra & 0xff00) >> 8;
\r
562 ra = (int)(b * 65535);
\r
563 hib = (ra & 0xff00) >> 8;
\r
565 tmp->pix(x*2 ,y, Color(hir/255.0, hig/255.0, hib/255.0, alpha));
\r
566 tmp->pix(x*2+1,y, Color(lor/255.0, log/255.0, lob/255.0, alpha));
\r
570 if(img.caches.count(this)!=0) {
\r
571 glEnable(GL_TEXTURE_2D);
\r
572 glBindTexture(GL_TEXTURE_2D, api_->VRAMoffset);
\r
573 glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, api_->tex_width, api_->tex_height, APIImageProperties::PixCompGL_[img.pixcomp_], APIImageProperties::PixPrecGL_[Image::BYTE], tmp->getBitmapPtr());
\r
574 glDisable(GL_TEXTURE_2D);
\r
576 api_ = new APIImageCache;
\r
577 img.caches.insert(std::pair<DrawableWithCache*, ImageCache_>(this, ImageCache_(api_, false)));
\r
578 api_->tex_width = tex_width;
\r
579 api_->tex_height = tex_height;
\r
580 glEnable(GL_TEXTURE_2D);
\r
581 glGenTextures(1, &api_->VRAMoffset);
\r
582 glBindTexture(GL_TEXTURE_2D, api_->VRAMoffset);
\r
583 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
\r
584 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
\r
585 // glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
\r
586 // glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
\r
587 glTexImage2D(GL_TEXTURE_2D, 0, Image::PixCompSize_[img.pixcomp_], api_->tex_width, api_->tex_height, 0, APIImageProperties::PixCompGL_[img.pixcomp_], APIImageProperties::PixPrecGL_[Image::BYTE], tmp->getBitmapPtr());
\r
588 glDisable(GL_TEXTURE_2D);
\r
590 // APIImageProperties::regist((int)Display::getWidth(), (int)Display::getHeight(), width_, height_, VRAMleft_, VRAMtop_);
\r
591 // glDisable(GL_BLEND);
\r
592 // glDrawBuffer(GL_AUX1);
\r
593 // for(int y=0; y<height_; y++) {
\r
594 // for(int x=0; x<width_; x++) {
\r
595 // Display::pix(x+VRAMleft_, y+VRAMtop_, getPix(x, y));
\r
598 // glDrawBuffer(GL_BACK);
\r
599 // glEnable(GL_BLEND);
\r
602 glDrawBuffer(GL_AUX1);
\r
603 glColor4f(1.0,1.0,1.0,1.0);
\r
604 glEnable(GL_TEXTURE_2D);
\r
605 glBindTexture(GL_TEXTURE_2D, api_->getTexIndex());
\r
607 glTexCoord2d(0 , img.height_);
\r
608 glVertex2f(img.targetarea_.getLeft() , img.targetarea_.getTop());
\r
609 glTexCoord2d(img.width_ , img.height_);
\r
610 glVertex2f(img.targetarea_.getRight()+1, img.targetarea_.getTop());
\r
611 glTexCoord2d(img.width_ , 0);
\r
612 glVertex2f(img.targetarea_.getRight()+1, img.targetarea_.getBottom()+1);
\r
613 glTexCoord2d(0, 0);
\r
614 glVertex2f(img.targetarea_.getLeft() , img.targetarea_.getBottom()+1);
\r
616 glDisable(GL_TEXTURE_2D);
\r
617 glDrawBuffer(GL_BACK);
\r
627 } /* <- namespace Psycholops */
\r