-
nidhi#123Likes 0Problem Description
the problem is that on open gl and on full screen i need to render random pixel.
x and y – the size of screen
r=rand()/RAND_MAX
if(r>0.5)
render pixel – white
else render pixel black
……………………………………………………………
i done this in normal c++ as follows but need to do same in opengl
#include "graphics.h"#include <stdlib.h>#include <dos.h>#include <windows.h>#include <iostream>using namespace std;double r;void randpixel(DWORD *h, DWORD *w, int *k){int i, j;cout << endl << "FOR ITERATION NO " << *k + 1 << endl;for (i = 0; i < *w; i++){for (j = 0; j < *h; j++){r = (double)rand() / RAND_MAX;if (r > 0.5){putpixel(i, j, BLACK);}else{putpixel(i, j, WHITE);}}}}int main(){int n, k = 0;DWORD w = GetSystemMetrics(SM_CXSCREEN);DWORD h = GetSystemMetrics(SM_CYSCREEN);cout << "Width: " << w << " Height: " << h << endl;cout << "How many times you want to iteration? ";cin >> n;initwindow(w, h, "" , -3,-3);do {randpixel(&h, &w, &k);k++;Sleep(5000);} while (k < n);getch();return 0;}
-
Sonar Systems adminLikes 0
Can you show me
Login to reply