473,324 Members | 2,511 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

C# and OpenGL

30
Hi, I programin whit C# and OpenGL, but I have one problam. I don't find wha't is wrong. Windows is white, don't do enything.

What's wrong?

And maybe some no good OpenGL+C# book for beginner?
Expand|Select|Wrap|Line Numbers
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using Tao.OpenGl;
  5.  
  6. namespace image
  7. {
  8.     class Begin
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             Glut.glutInit();
  13.             Glut.glutInitDisplayMode(Glut.GLUT_SINGLE | Glut.GLUT_RGB);
  14.  
  15.             Glut.glutInitWindowSize(400, 400);
  16.             Glut.glutInitWindowPosition(400, 300);
  17.             Glut.glutCreateWindow("Image");
  18.  
  19.             Init();
  20.  
  21.             Glut.glutDisplayFunc(new Glut.DisplayCallback(Show));
  22.  
  23.             Glut.glutMainLoop();
  24.  
  25.         }
  26.  
  27.         static void Init()
  28.         {            
  29.            Gl.glClearColor(1.0f, 1.0f, 1.0f, 1.0f); 
  30.         }
  31.  
  32.         static void Show()
  33.         {
  34.             Gl.glClear(Gl.GL_COLOR_BUFFER_BIT); //Clear buffer
  35.  
  36.             float[] mas_quad = { -0.5f, -0.5f, -0.5f, 0.5f, 0.5f, 0.5f, 0.5f, -0.5f };
  37.             float[] color_mas = { 0.5f, 0.1f, 0.5f, 0.5f, 0.1f, 0.6f, 0.0f, 0.8f, 0.0f, 0.0f, 0.5f, 4.0f };
  38.             Gl.glVertexPointer(2, Gl.GL_FLOAT, 0, mas_quad);
  39.             Gl.glColorPointer(3, Gl.GL_FLOAT, 0, color_mas);
  40.             Gl.glBegin(Gl.GL_POLYGON);
  41.             for (int i = 0; i < 4; i++)
  42.                 Gl.glArrayElement(i);
  43.             Gl.glEnd();
  44.             Gl.glFlush();
  45.         }
  46.       }
  47. }
  48.  
Oct 2 '08 #1
0 1889

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Rick Muller | last post by:
I have a problem that I would like to get some advice on from other Pythonistas. I currently manage a (soon to be) open source project for displaying molecular graphics for a variety of different...
15
by: oracle411 | last post by:
Hi I'm new to OpenGL, but have an OpenGL application written in CPP that I would like to display on a web browser. Was wondering how this could be done? Thank you very much
2
by: Michael Sgier | last post by:
Hi OpenGL in VC7. I get errors with the default include gl file. Which and where to get working OpenGL files? I also get errors with glfunctions in Kdevelop. Any help here? Thanks indeed....
3
by: john townsley | last post by:
Hi I want to do some OpenGl stuff with c++ on a winXP (home) machine. I have Borland c++ 5, MVS c++ 5 What C++ do you recommend (any others?)and where do you get the OpenGL stuff. thanks
10
by: Bad_Kid | last post by:
which is better for what?
0
by: Scott Chang | last post by:
Hi all, I tried to use Managed C++ coding of VC++.NET (2002)and OpenGL version 1.2 to draw a hexagon shape of benzene. My OpenGLdrawBenzene.cpp is the following: // This is the main project file...
4
by: tobfon | last post by:
I'm creating a scientific visualization application with rather high demands on performance. I've created a nice rendering engine for it in C++/OpenGL and a python interface to the rendering...
3
by: jg.campbell.ng | last post by:
I'm beginning learning Python and OpenGL in Python. Python fine. But difficulties with OpenGL; presumably with the installation of OpenGL. OS = Linux FC5. Python program gl_test.py: from...
9
by: Achim Domma | last post by:
Hi, I'm developing a GUI app in Python/C++ to visualize numerical results. Currently I'm using Python 2.4 with wx and PyOpenGLContext, but there are no windows binaries for Python 2.5 for quite...
3
by: Leon | last post by:
Hey, i am trying to develop a game, and I am using OpenGL and pthread. (on Ubuntu, so i also use the X library.) Now i have a problem. I have initialized OpenGL in the main thread, and i want to...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.